Advertisement

Windows programming problem...

Started by March 02, 2002 08:02 AM
13 comments, last by shakazed 22 years, 6 months ago
The problem is that you''re always returning 0 from your message loop. When calling the default window procedure, make sure you also return its value.

So, replace DefWindowProc(hWnd, msg,wParam,lParam); with return DefWindowProc(hWnd, msg,wParam,lParam); and everything will work.

Kippesoep
Thanks, that solved it.

sHaKaZeD
Advertisement
A new question though. Why do you need to return DefWindowProc() to make it work. Wouldn´t the application still create and display the window? Cuz GetMessage() waits until there´s a message in the app. queue and then sends it to WndProc().

sHaKaZeD
oh i think it''s because if you return 0, it''s also equivalent to shutting down your program,
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
Here is a little something I cut out from MSDN:


CreateWindowEx

Remarks
The CreateWindowEx function sends WM_NCCREATE, WM_NCCALCSIZE, and WM_CREATE messages to the window being created.





WM_NCCREATE
The WM_NCCREATE message is sent prior to the WM_CREATE message when a window is first created.

Return Values
If an application processes this message, it should return TRUE to continue creation of the window. If the application returns FALSE, the CreateWindow or CreateWindowEx function will return a NULL handle.

So you can clearly see that the first message processed is the WM_NCCREATE wich return 0 to indicate failure.
--------------------------------"I'm a half time coder, full time Britney Spears addict" Targhan

This topic is closed to new replies.

Advertisement