Hi, I made this little stupid OpenGL demo thing doesnt do much at all, but when I try to close it, it doesnt go to my exit Prodecure. I test for the following conditions in my WndProc

.IF uMsg== WM_QUIT
invoke PostQuitMessage, NULL
xor eax,eax
.IF wParam == VK_ESCAPE
INVOKE PostQuitMessage, NULL
mov eax,NULL
mov eax,NULL
.ELSEIF wParam == 50h
mov eax,NULL
INVOKE PostQuitMessage, NULL
xor eax,eax

I test for WM_DESTROY and WM_QUIT, but when I close the window, I programmed it so Windows would change the resolution back to the default but it doesnt!! Lets say the user clicks on the "X" at the top of window which message does Windows dispatch?
Posted on 2002-09-13 07:20:36 by x86asm
Try processing WM_CLOSE ....

Am not sure which message windows dispatches, but I think its WM_QUIT, but try processing WM_CLOSE, and see if that works :)
Posted on 2002-09-13 07:25:09 by Dracton
Thanks let me try it I'm in fornt of my PC so I can test it right now ;)
Posted on 2002-09-13 07:25:49 by x86asm
IT worked, thank you Dracton !!!!!!!!!!!!!!!!!!!!!!! :alright:
Posted on 2002-09-13 07:26:46 by x86asm
Your welcome ;)

Wow, you've just made my day mate, I SOOOOO love helping people :D
Posted on 2002-09-13 07:28:25 by Dracton
:alright: I like to also when I can ;)
Posted on 2002-09-13 07:32:25 by x86asm
WM_QUIT is normally a posted thread message. It does not go directly to a window. Your conventional message loop quits when it sees this message, and thus DispatchMessage (and your WndProc) is never called.
Posted on 2002-09-13 21:08:06 by tenkey
Windows sends quite a few messages upon clicking the 'X'. From your prespective the first important one is WM_CLOSE. When the WM_CLOSE message is sent to your window, it still exists but WINDOWS is notifying it that it has recieved a close request. If you do not handle the WM_CLOSE message and DefWindowProc gets it, DefWindowProc calls DestroyWindow to remove your window from the screen. DestroyWindow send a WM_DESTROY message to your window after it has already gone bye-bye. If you call PostQuitMessage in response to WM_DESTROY, the GetMessage function in your message loop returns zero upon finding the WM_QUIT message and that is usually it's cue (pun intended :D) to stop looping. (If you use PeekMessage you should check for WM_QUIT explicitly in the message loop).

Anyway enough rambling....heh. That is pretty much the order of things as I recall it. A WM_QUIT message should never get to your window procedure. Also, since the window is no longer visible during WM_DESTROY processing you can get surprising results if you try to do certain things there. Make sure that your message loop exits under the right conditions and try fixing the resolution in WM_CLOSE handling if WM_DESTROY handling isn't cutting it. I don't know much about openGL and how it cooperates (or fails to cooperate) with the GDI so...


//do mysterious openGL things

invoke DestroyWindow, hwnd

//return 0

Remember to call DestroyWindow when you're done since you are handling the message not DefWindowProc. If you don't, your app won't quit as you would expect.

lol...there were like a million posts before I was done.
Anyway, I won't edit. Glad you got it working x86. :)
Posted on 2002-09-13 21:52:23 by Thanatos
And just for future reference:

WM_QUIT is send when you call PostQuitMessage, but the WM_QUIT message is not associated with a window and therefore will never be received through a window's window procedure. It is retrieved only by the GetMessage or PeekMessage functions.
Posted on 2002-09-13 21:55:05 by JimmyClif
ohhh, thank you all for slapping me with knowledge (nice joke eh?) :alright:
Posted on 2002-09-14 11:57:01 by x86asm
Best of all, thanks for the stupid thread name - "windows"- this really explains exactly what you want, doesn't it. I just love clicking that link, for the mystery of what could lie behind!
Posted on 2002-09-14 21:24:41 by mega
Posted on 2002-09-14 21:25:25 by x86asm