Lesson 1, Problem Closing My Window

Started by
2 comments, last by jleffelm 20 years, 3 months ago
I have been working on my program for a little bit of time, and all of a sudden, I can''t close the window using the X in the upper right corner(I am working on Win2k). Well, if I hit that button twice, the window will close. If I use the ESC key, the program closes fine. I believe my code for the windows interface mirrored NeHe''s lesson 1. I can''t find any differnces, and this code has worked fine before. I was curious if anyone has run into this problem before, and if they know what might be causing this. My best guess as to what is happening, is that when I hit the X, WndProc sends the WM_CLOSE case, which calls PostQuitMessage(0), and then the second click on the X, causes WinMain, to see the WM_QUIT sent by PostQuitMessage, in the PeekMessage command, and then again in WndProc. Shouldn''t the PeekMessage be called fairly frequently, and not need a second event to trigger it? Or am I completely confused about what is going on here? Did I click a setting somewhere(I am using Visual C++ 6.0) to cause for a differnt type of compile? Also, is the code that NeHe uses for the first tutorial, the same basic windows code he uses for all his tutorials, and a good starting place for my windows interface. I ask because I have the book OpenGL Game Programming, and the windows code changes from example to example. I realize parts of it will change as different user input is added, but the basic logic seams to change a little each time. Thanks for any help/insight you can send my way. -Drew
Advertisement
I ran into it a couple of times. Do you have a infinite loop somewhere or an extra thread.



[edited by - Iceman48 on January 6, 2004 10:40:31 PM]
Chris Nitegale
Are you using a HWND handle in PeekMessage/GetMessage?

If yes, set that param to NULL.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

quote:Original post by Endurion
Are you using a HWND handle in PeekMessage/GetMessage?

If yes, set that param to NULL.


Thank you, this fixed it.

This topic is closed to new replies.

Advertisement