WM_POWERBROADCAST message not caught in MFC Dlg
问题 I try to catch WM_POWERBROADCAST message when the system goes into sleep mode. I'm doing like : BOOL CPowManApp::PreTranslateMessage(MSG* pMsg) { if(pMsg->message == WM_POWERBROADCAST || pMsg->message == WM_POWER) { CString strMessage; strMessage.Format(_T("%d WM_POWERB%s wParam %x lParam %x"), pMsg->time, pMsg->message == WM_POWER?_T(""):_T("BRAODCAST"), pMsg->wParam, pMsg->lParam); OutputDebugString(strMessage); } return CWinApp::PreTranslateMessage(pMsg); } It simply doesn't work.