Hello,
I''m developing a little game engine just for fun, but I''m having problems with my message loop...
I''ll give you some code...
m_bActive is true when the program starts, the only place that changes it is this (it''s inside the message proc):
case WM_ACTIVATEAPP:
m_bActive = wParam;
break;
while (msg.message != WM_QUIT)
{
if ( PeekMessage( &msg,NULL,0,0,PM_NOREMOVE ) )
{
if ( GetMessage(&msg, NULL, 0, 0) < 0 )
return msg.wParam;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
if (m_bActive)
{
Update();
}
else
WaitMessage();
}
}
My problem simply is that the app works fine until you minimize the application, then windows dosen''t leave the WaitMessage loop correctly (if I start to pause the program using the debugger it sometimes comes out of the loop and the application starts to behave correctly)...
I''ve tried with Sleep instead of WaitMessage(with lots of diffrent vaules, in the range from 100 - 1000) and nothing helps, I get the same error anyway...