I added WM_ENDSESSION handler to CMainFrame class of SDI application:
void CMainFrame::OnEndSession(BOOL bEnding)
if ( bEnding )
When I reboot/log off while program is running, this function is not called. If I do the same in MDI application, it works - I hear beep. How can I handle computer shitdown/log off event in SDI application?