You sure can it makes a bit more sense if I show you the entire Message Handler.
Code:
LRESULT CALLBACK messageHandler(HWND theHandle, UINT theMsg,
WPARAM wParam, LPARAM lParam)
{
// Put all arguements in a switch statement
switch(theMsg)
{
case WM_CREATE:
{
// CODE ADDED IN REACTION TEST VERSION BETA 3
// On createion of the window start one timer
// with an ID of 1 and a 2 min 30 span
SetTimer(theHandle,1,30000,NULL);
// END OF CODE ADDED IN REACTION TEST VERSION BETA 3
return 0;
break;
}
case WM_PAINT:
{
// How to redraw the current window
PAINTSTRUCT ps;
HDC hdc = BeginPaint(theHandle,&ps);
// Extra painting code goes in here
EndPaint(theHandle,&ps);
return 0;
break;
}
case WM_DESTROY:
{
// Post quit message when the window is destroyed
PostQuitMessage(0);
return 0;
break;
}
// CODE ADDED IN REACTION TEST VERSION BETA 1
case WM_TIMER:
{
// put all timers in a switch statement to see
// which one went off
switch (wParam)
{
case 1:
{
// CODE ADDED IN REACTION TEST VERSION BETA 3
theGame.getStats().IncrementState();
// now check to see if 2 min 30 has passed
// and if it has send quit message
if ((theGame.getStats().getState()) == 6)
PostQuitMessage(0);
return 0;
break;
// END OF CODE ADDED IN REACTION TEST VERSION BETA 3
}
default:
break;
}
}
// END OF CODE ADDED IN REACTION TEST VERSION BETA 1
default:
{
// If the message hasn't been handled let windows
// do it
return (DefWindowProc(theHandle,theMsg,wParam,lParam));
break;
}
}
}
Now what happens is that the programs ends after 30 seconds. WHich means the state must equal 6. Now it shouldn't equal six until 2 and half minutes has passed.
((The constructor automatically sets the state to 1))