SetLastError in CreateWindowEx

Dan Hipschman dsh at linux.ucla.edu
Fri Jul 7 23:26:55 CDT 2006


I noticed that sometimes when CreateWindowEx fails and the app tries to
display a helpful error message, you get something like "Couldn't create
window: Success."  These are the error codes that XP sets for the given
failures.

ChangeLog:
* Correctly call SetLastError in a few places where CreateWindowEx fails.
---
 dlls/user/win.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/dlls/user/win.c b/dlls/user/win.c
index fa2af00..93e4eba 100644
--- a/dlls/user/win.c
+++ b/dlls/user/win.c
@@ -876,6 +876,7 @@ static HWND WIN_CreateWindowEx( CREATEST
         if (!(flags & WIN_ISMDICLIENT))
         {
             WARN("WS_EX_MDICHILD, but parent %p is not MDIClient\n", cs->hwndParent);
+            SetLastError(ERROR_INVALID_WINDOW_HANDLE);
             return 0;
         }
 
@@ -954,6 +955,7 @@ static HWND WIN_CreateWindowEx( CREATEST
         if ((cs->style & (WS_CHILD|WS_POPUP)) == WS_CHILD)
         {
             WARN("No parent for child window\n" );
+            SetLastError(ERROR_TLW_WITH_WSCHILD);
             return 0;  /* WS_CHILD needs a parent, but WS_POPUP doesn't */
         }
         if (classAtom != LOWORD(DESKTOP_CLASS_ATOM))  /* are we creating the desktop itself? */
-- 
1.4.0




More information about the wine-patches mailing list