I'm trying to catch WM_QUERYENDSESSION to save some data in the app, but it seems that I'm not receiving this message on User logoff/system restart when the app is minimized to the system tray. How can I catch it?
Thanks.
Relevant code (nothing magic in there,开发者_StackOverflow hopefully :)):
ON_WM_QUERYENDSESSION()
BOOL CMainFrame::OnQueryEndSession()
{
AfxMessageBox(L"Are we hitting this?");
return FALSE;
}
For the tray icon I'm using a third-party lib (CodeJock), which I probably can't post here, but generally, it creates a hidden window to process messages, but the main window is simply ShowWindow(SW_HIDE) when needed. Maybe I need to intercept that message in that hidden window and pass it up, I'll need to try that.
This is basically eaten by a third-party class that I'll need to fix up.
精彩评论