Sign in to follow this  
celu

win32 process not ending!

Recommended Posts

celu    126
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
Evil Steve    2017
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this