WM_POWERBROADCAST message did not hit MFC Dlg
I am trying to catch the WM_POWERBROADCAST message when the system goes to sleep.
I am 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 just doesn't work. Meanwhile the win32 app works fine. I tried to route a message handler to the Dlg class in vain.
I am creating an application with VS6.0. Where am I going wrong?
0
a source to share
2 answers