Hi,

I was wondering if anyone know more about the WM_QUERYENDSESSION. I know that windows sends that message to all the applications when it is shutting down? But how do I get the message and respond back to it?

I am currently incorporating it like this is my LRESULT CALLBACK WndProc function:

case WM_QUERYENDSESSION:
{
ErrorMessage("User is logging off. Terminating the program");
SendMessage(hWnd,WM_DESTROY,0,0);
break;
}

Am I not supposed to use the ErrorMessage box? Also, how do I reply back to say that it is ok to shutdown. And do i need to define WM_QUERYENDSESSION anywhere? Also what about logoff and restart; is WM_QUERYENDSESSION used then too?

Thanks!