Quote:Original post by Programmer16Quote:Original post by Endurion
A few tiny mistakes:
1)
The main problem: Remove the HWND in your message loop. Pass NULL instead. Otherwise you only process messages of the main window.
2)
Move the return DefWindowProc OUT OF THE DEFAULT CASE AFTER THE SWITCH.
3)
You're calling PostQuitMessage twice, one in the main window close, one in the modeless dialog proc.
Where his DefWindowProc call is shouldn't be a problem. If he handles a message he calls break which falls to return 0. Otherwise, it calls DefWindowProc (for message he doesn't handle.) Unless I missing something.
No, that's correct. I would recommend inverting the logic though and dropping the default case. Have the method return DefWindowProc by default, and the individual cases return (instead of breaking) the appropriate value. This is because not all message types return 0 if the user handles them. Some return other values depending on success or failure.