CreateWindow(parent=NULL, ctlid!=0) should fail

Francois Gouget fgouget at codeweavers.com
Thu Aug 4 17:20:26 CDT 2005


When I ran the listbox test on Windows it crashed due to the assert 
immediately following the CreateWindow() call. The reason is that 
controls with no parent cannot have an id. Windows >= NT returns an 
invalid HMENU error in that case.


Changelog:

  * dlls/user/tests/win.c

    Francois Gouget <fgouget at codeweavers.com>
    CreateWindow(parent=NULL, ctlid!=0) should fail.


-- 
Francois Gouget
fgouget at codeweavers.com

-------------- next part --------------
Index: dlls/user/tests/win.c
===================================================================
RCS file: /var/cvs/wine/dlls/user/tests/win.c,v
retrieving revision 1.66
diff -u -p -r1.66 win.c
--- dlls/user/tests/win.c	2 Aug 2005 09:56:25 -0000	1.66
+++ dlls/user/tests/win.c	3 Aug 2005 23:05:20 -0000
@@ -2805,12 +2805,24 @@ static void test_scroll(void)
 
 static void test_params(void)
 {
+    HWND hwnd;
     INT rc;
 
     /* Just a param check */
     SetLastError(0xdeadbeef);
     rc = GetWindowText(hwndMain2, NULL, 1024);
     ok( rc==0, "GetWindowText: rc=%d err=%ld\n",rc,GetLastError());
+
+    hwnd=CreateWindow("LISTBOX", "TestList",
+                      (LBS_STANDARD & ~LBS_SORT),
+                      0, 0, 100, 100,
+                      NULL, (HMENU)1, NULL, 0);
+    todo_wine {
+    ok(hwnd==NULL, "CreateWindow(parent=NULL, ctlid!=0) should have failed\n");
+    }
+    /* NT sets LastError to ERROR_INVALID_MENU_HANDLE
+     * but Win9x leaves it unchanged. So no test.
+     */
 }
 
 static void test_AWRwindow(LPCSTR class, LONG style, LONG exStyle, BOOL menu)


More information about the wine-patches mailing list