Jump to content
  • Advertisement
Sign in to follow this  
quaker

Window Loop

This topic is 4578 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
How are you handling the close and destroy window messages in your win proc? I ask because your while loop looks fine to me.

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
Ya I forgot to mention it's a D3D application. when I take out the D3D code it works fine.

Share this post


Link to post
Share on other sites
Ya I forgot to mention it's a D3D application. when I take out the D3D code it works fine.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!