• Advertisement
Sign in to follow this  

[SOLVED] CreateWindowEx problem

This topic is 4366 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

After CreateWindowEx fails, it gave me error code 1400, which is "invalid window handle". Why would it be that error if the window handle (for the parent, which is the only thing it can possibly be talking about) is NULL? I'm not making a child window. Any help is appreciated. [Edited by - F-Kop on May 7, 2006 5:15:44 PM]

Share this post


Link to post
Share on other sites
Advertisement
also, what type of window class are you using? control classes must have a parent window. and if i recall right, even dialogs created from CWEx, must have a valid parent window handle supplied to CWEx.

Share this post


Link to post
Share on other sites
Are there any child controls on the window which you try to create in WM_CREATE?

What does your WindowProc look like? Are you trying to make a class wrapper?

Share this post


Link to post
Share on other sites
It is a class wrapper. It worked fine for my CWnd class, but not CFrameWnd.

if( !( m_handle = CreateWindowEx( styleEx, className, text, style,
box.x, box.y, box.w, box.h, ( parent? parent->m_handle : NULL ),
( menu? menu->m_handle : NULL ), g_inst, NULL ) ) )
return FALSE;


styleEx is NULL, className is "CFrameWnd", which was registered successfully, text is "blah", style is WS_OVERLAPPEDWINDOW, box is the coordinates and size, (which are all CW_USEDEFAULT), parent is NULL, menu is NULL, and g_inst is the instance returned by GetModuleHandle.

The error code says "invalid window handle". The only window handle involved is the parent window, which is NULL in this case, and I'm not creating a child window.

Share this post


Link to post
Share on other sites
Nothing wrong from this part. Again, what does the window proc look like?

Note that the window proc will have to process some messages during CreateWindow(Ex) already. Even if the class handler is not completely initialized the messages need to be passed on to at least DefWindowProc. My guess is that the HWND passed to your window proc is not passed on correctly.

Share this post


Link to post
Share on other sites
Yeah it was a wndproc problem, but it's solved now.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement