Jump to content
  • Advertisement
Sign in to follow this  
celu

win32 process not ending!

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

hi I wrote a sample directx application to learn about vertex and index buffers.The application is working fine,no problems there..but, when I hit the close button on my application window,the application window closes, but the process does not end! i have to close it everytime using the task manager..why is this happening? heres my message loop.. while(1) { if(PeekMessage(&msg,hwnd,0,0,PM_REMOVE)) { if(msg.message == WM_QUIT) break; TranslateMessage(&msg); DispatchMessage(&msg); } else display(); } heres the window procedure.... LRESULT CALLBACK WndProc(HWND hwnd, UINT msg1, WPARAM wParam, LPARAM lParam) { switch(msg1) { case WM_DESTROY: PostQuitMessage(0); if(d3ddevice!=NULL) //my d3ddevice d3ddevice->Release(); if(d3dobj!=NULL) //my d3d object d3dobj->Release(); return 0; case WM_PAINT: ValidateRect(hwnd,NULL); return 0; } return DefWindowProc(hwnd, msg1, wParam, lParam); } hope these two portions of the code would be enough to identify the problem.. what am i doing wrong? HELP!!

Share this post


Link to post
Share on other sites
Advertisement
PostQuitMessage() posts a WM_QUIT message in the message queue for the current thread, but your PeekMessage() call is only reading messages for the window. Change your hwnd parameter in PeekMessage() to NULL and it should work fine.

I.e.:
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))

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!