Jump to content
  • Advertisement
Sign in to follow this  
nfries88

[C++ - Win32 API] PeekMessage never returning false?

This topic is 2560 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

I have a curious bug where your typical PeekMessage call (PeekMessage(&msg, mywindow, 0, 0, PM_REMOVE)) never returns false.

Compiler is MinGW 3.4.5, Windows 7, it's a WOW64 process. Anyone know anything about any such bug

EDIT: Solved. Apparently ValidateRect(hwnd, NULL) is not an appropriate response to a WM_PAINT message. DefWindowProc fixed it.

Share this post


Link to post
Share on other sites
Advertisement
Hint: Also, if you don't have a good reason, do NOT supply a HWND value to PeekMessage. You'll only retrieve messages for your HWND then, but you'll miss WM_QUIT for example, which is a thread message.

Share this post


Link to post
Share on other sites

Hint: Also, if you don't have a good reason, do NOT supply a HWND value to PeekMessage. You'll only retrieve messages for your HWND then, but you'll miss WM_QUIT for example, which is a thread message.


MSDN documentation on WM_QUIT is not that great, I only get that the thread will no longer receive events once the WM_QUIT event is received. Is there a case where WM_QUIT would be put into the queue without my explicitly calling PostQuitMessage()?

Share this post


Link to post
Share on other sites
AFAIK PostQuitMessage is the only official way to have WM_QUITs generated. However I'm not sure, if there are no internal functions that end up calling it (somewhere deep in DefWindowProc).

Also, Raymond Chen has some interestings quirks to look out for here: Old New Thing

Share this post


Link to post
Share on other sites

AFAIK PostQuitMessage is the only official way to have WM_QUITs generated. However I'm not sure, if there are no internal functions that end up calling it (somewhere deep in DefWindowProc).

Also, Raymond Chen has some interestings quirks to look out for here: Old New Thing


Yep, read it.
Seems like WM_QUIT is only important to process if you do your logic mostly or completely within the window procedure. I don't.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!