I have a problem with WM_ENDSESSION message. Namely I would like to exit from the main loop of the application (WindowProc) when the WM_ENDSESSION message is sending... So, I wrote something like that:
LRESULT CALLBACK windowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
//...
case WM_QUERYENDSESSION: return TRUE;
case WM_ENDSESSION:
if(wParam) PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,msg,wParam,lParam);
}
return 0;
}
..., but it doesn't work - application doesn't exit the main loop...
I read about WM_QUERYENDSESSION and WM_ENDSESSION on msdn, but I couldn't find any helpful information...
Any idea, where is the mistake?