PostQuitMessage(0) Causes Crash ?
hi,When i call PostQuitMessage(0) More Then One Time
İt will Crash the Program and Lock the Computer.
thanks for answer, and here is my Loop:
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd)
{
SetupGame();
MSG Msg;
ZeroMemory( &Msg,sizeof(Msg) );
while( true )
{
if(PeekMessage(&Msg,0,0,0,PM_REMOVE))
{
if(Msg.message==WM_QUIT)
break;
TranslateMessage(&Msg);
DispatchMessage (&Msg);
}
else
{
RenderGame();
}
}
return Msg.wParam;
CleanGame();
return EXIT_FAILURE;
}
/*-------------------------------------------*/
You shouldn't ever be calling PostQuitMessage more than once. When you call that function it's game over: you get your WM_QUIT message and you're supposed to exit your message loop.
On what line of code does your app actually crash? Also, why do you have code after the return statement in your main function? Your CleanGame function will never get run.
Also, if when you're posting code please use the "code" or "source" tags. See the FAQ for more info.
On what line of code does your app actually crash? Also, why do you have code after the return statement in your main function? Your CleanGame function will never get run.
Also, if when you're posting code please use the "code" or "source" tags. See the FAQ for more info.
Yeah, your code after your first return message wont work as pointed out from above.
So, if there is any cleaning to do, you will get memory leaks.
So, if there is any cleaning to do, you will get memory leaks.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement