• Advertisement
Sign in to follow this  

Window Loop

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

Why I get application error, break point reached ... when I close the program or send close message? while (1) { if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) break; TranslateMessage(&msg); DispatchMessage(&msg); } else { ..... } } Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Try doing as follows

PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)
while ( msg.message != WM_QUIT )
{
TranslateMessage(&msg);
DispatchMessage(&msg);
PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
}

Share this post


Link to post
Share on other sites
Yeah your message loop is fine, I just do a while (!done) then when I hit WM_QUIT and change done to true and exit gracefully. I think its neater looking and easier to follow then a break like yours but it's looks nothing more.

What's the actual error you are getting and how are you handling, like LostSource asked, your WndProc for the close/destroy messages?

Share this post


Link to post
Share on other sites
Actually I handle the following message:

WM_DESTROY:
PostQuitMessage(0);


And the application error message:

The exception breakpoint
A breakpoint has been reached.
(0x80000003) occurred in the application at location 0x...

Strange!


Share this post


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

  • Advertisement