Archived

This topic is now archived and is closed to further replies.

Freaky problem

This topic is 5142 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''ve been working my way through a book on DirectX. I only have the following problem when I implement D3D. It''s a basic implementation to just draw some pixels to the screen. I''m just at a point where something pretty wierd seems to be happening in my message loop... PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE); // run till completed while (msg.message!=WM_QUIT) { if (PeekMessage( &msg, NULL, 0, 0, PM_REMOVE)) { // dispatch the message TranslateMessage(&msg); DispatchMessage(&msg); } else { GameLoop(); } } The problem is GameLoop() Never gets called! I modified my code a bit to output the first 100 window messages to the debug window and they''re all f..er 15.. Looked it up in Winuser.h: #define WM_PAINT 0x000F Looks like I''m being flooded with paint messages! Also, if I put the call to gameloop somewhere else, like in a loop that executes 100 times everything draws fine, program exits fine with no error messages etc.. I was wondering if anyone knows what would send non-stop paint messages to my window to the point where my loop is never idle? Or if you think my problem is somewhere else I''d love to hear it? Thanks! Sean

Share this post


Link to post
Share on other sites
Have you captured the WM_PAINT event in your window procedure? If you have then you need to call BeginPaint and EndPaint to let Windows know you handled it. Otherwise it just sends it over and over and over...

Share this post


Link to post
Share on other sites
<<>>

Ha! Thank you so much..

well.. im not using gdi(yet) so I needed:

ValidateRect(g_hWndMain,NULL);

but it took a whole 2 seconds after reading your post to realize it.. works fine! Thanks man, your a lifesaver


Share this post


Link to post
Share on other sites
<>


makes a big difference.. anything outside the loop only gets called once a quit message has been posted.. ie only executes once.. inside the loop the loop either handles the message or runs the gameloop, which contains my render code

Share this post


Link to post
Share on other sites