SetClassLongPtrA( hwnd, GCLP_HMODULE, 0xdeadbeef );
check_instance( "EDIT", (HINSTANCE)0x12345678, (HINSTANCE)0x12345678, (HINSTANCE)0xdeadbeef );
check_thread_instance( "EDIT", (HINSTANCE)0x12345678, (HINSTANCE)0x12345678, (HINSTANCE)0xdeadbeef );
+ DestroyWindow(hwnd);
}
static void test_builtinproc(void)
oldproc = (WNDPROC)SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (LONG_PTR)ClassTest_WndProc);
ok(IS_WNDPROC_HANDLE(oldproc) == FALSE, "Class %s shouldn't return a handle\n", NORMAL_CLASSES[i]);
+ SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (LONG_PTR)oldproc);
DestroyWindow(hwnd);
}
CallWindowProcW((WNDPROC)GetWindowLongPtrW(hwnd, GWLP_WNDPROC), hwnd, WM_GETTEXT, 120, (LPARAM)buf);
ok(memcmp(buf, classW, sizeof(classW)) == 0, "WM_GETTEXT invalid return\n");
+ SetWindowLongPtrA(hwnd, GWLP_WNDPROC, (LONG_PTR)oldproc);
+
DestroyWindow(hwnd);
hwnd = CreateWindowA(WC_EDITA, classA, WS_OVERLAPPEDWINDOW,
CallWindowProcW((WNDPROC)GetWindowLongPtrW(hwnd, GWLP_WNDPROC), hwnd, WM_GETTEXT, 120, (LPARAM)buf);
ok(memcmp(buf, classW, sizeof(classW)) == 0, "WM_GETTEXT invalid return\n");
- SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (LONG_PTR)ClassTest_WndProc);
+ oldproc = (WNDPROC)SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (LONG_PTR)ClassTest_WndProc);
SetWindowTextW(hwnd, unistring);
CallWindowProcW((WNDPROC)GetWindowLongPtrW(hwnd, GWLP_WNDPROC), hwnd, WM_GETTEXT, 120, (LPARAM)buf);
ok(memcmp(buf, unistring, sizeof(unistring)) == 0, "WM_GETTEXT invalid return\n");
CallWindowProcA((WNDPROC)GetWindowLongPtrA(hwnd, GWLP_WNDPROC), hwnd, WM_GETTEXT, 120, (LPARAM)buf);
ok(memcmp(buf, classA, sizeof(classA)) == 0, "WM_GETTEXT invalid return\n");
+ SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (LONG_PTR)oldproc);
+
DestroyWindow(hwnd);
}
broken(hi == 0xbeef), /* win2k */
"Expected 0, got %08lx\n", hi);
- hglobal = GlobalAlloc(GMEM_DDESHARE, 2);
+ hglobal = GlobalAlloc(GMEM_DDESHARE, 2 * sizeof(*ptr));
ptr = GlobalLock(hglobal);
ptr[0] = 0xcafebabe;
ptr[1] = 0xdeadbeef;
ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
ok(lo == 0, "Expected 0, got %08lx\n", lo);
ok(hi == 0xcafebabe, "Expected 0xcafebabe, got %08lx\n", hi);
+
+ GlobalFree(hglobal);
}
static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV hconv,
DestroyWindow(hWnd);
}
+/* Test WM_GETTEXT processing
+ * after destroy messages
+ */
+static void test_edit_control_6(void)
+{
+ static const char *str = "test\r\ntest";
+ char buf[MAXLEN];
+ LONG ret;
+ HWND hWnd;
+
+ hWnd = CreateWindowEx(0,
+ "EDIT",
+ "Test",
+ 0,
+ 10, 10, 1, 1,
+ NULL, NULL, hinst, NULL);
+ assert(hWnd);
+
+ ret = SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)str);
+ ok(ret == TRUE, "Expected %d, got %d\n", TRUE, ret);
+ ret = SendMessageA(hWnd, WM_GETTEXT, MAXLEN, (LPARAM)buf);
+ ok(ret == lstrlen(str), "Expected %s, got len %d\n", str, ret);
+ ok(!lstrcmp(buf, str), "Expected %s, got %s\n", str, buf);
+ buf[0] = 0;
+ ret = SendMessageA(hWnd, WM_DESTROY, 0, 0);
+ ok(ret == 0, "Expected 0, got %d\n", ret);
+ ret = SendMessageA(hWnd, WM_GETTEXT, MAXLEN, (LPARAM)buf);
+ ok(ret == lstrlen(str), "Expected %s, got len %d\n", str, ret);
+ ok(!lstrcmp(buf, str), "Expected %s, got %s\n", str, buf);
+ buf[0] = 0;
+ ret = SendMessageA(hWnd, WM_NCDESTROY, 0, 0);
+ ok(ret == 0, "Expected 0, got %d\n", ret);
+ ret = SendMessageA(hWnd, WM_GETTEXT, MAXLEN, (LPARAM)buf);
+ ok(ret == 0, "Expected 0, got len %d\n", ret);
+ ok(!lstrcmp(buf, ""), "Expected empty string, got %s\n", buf);
+
+ DestroyWindow(hWnd);
+}
+
static void test_edit_control_limittext(void)
{
HWND hwEdit;
test_edit_control_3();
test_edit_control_4();
test_edit_control_5();
+ test_edit_control_6();
test_edit_control_limittext();
test_margins();
test_margins_font_change();
static void test_SetFocus(HWND hwnd)
{
- HWND child;
+ HWND child, child2;
WNDPROC old_wnd_proc;
/* check if we can set focus to non-visible windows */
ok( !(GetWindowLong(child,GWL_STYLE) & WS_VISIBLE), "Child %p is visible\n", child );
ok( GetFocus() == hwnd, "Focus should be on parent %p, not %p\n", hwnd, GetFocus() );
ShowWindow(child, SW_SHOW);
+ child2 = CreateWindowExA(0, "static", NULL, WS_CHILD, 0, 0, 0, 0, child, 0, 0, NULL);
+ assert(child2);
+ ShowWindow(child2, SW_SHOW);
+ SetFocus(child2);
+ ShowWindow(child, SW_HIDE);
+ ok( !(GetWindowLong(child,GWL_STYLE) & WS_VISIBLE), "Child %p is visible\n", child );
+ ok( GetFocus() == child2, "Focus should be on %p, not %p\n", child2, GetFocus() );
+ ShowWindow(child, SW_SHOW);
SetFocus(child);
ok( GetFocus() == child, "Focus should be on child %p\n", child );
SetWindowPos(child,0,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_HIDEWINDOW);
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)old_wnd_proc);
+ DestroyWindow( child2 );
DestroyWindow( child );
}