I'm trying to write an application to detect when the system returns from
standby. I can do this easily with a VCL app with a hdden window, minimized,
but the whole lot compiles to 460KB with everything linked in (which is the
way we do it here). An equivalent console app is only 50KB, so I tried
putting together the following as a demo:
//---------------------------------------------------------------------------
#include <windows.h>
#pragma hdrstop
#include <winuser.h>
//---------------------------------------------------------------------------
#pragma argsused
WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
lpCmdLine, int nCmdShow)
{
MSG msg;
HWND hWnd = NULL;
UINT filterMin = 0;
UINT filterMax = 0;
bool getOut = false;
int messageValue;
while (!getOut) {
messageValue = GetMessage(&msg, hWnd, filterMin, filterMax);
if (messageValue == 0) { getOut = true; }
if (messageValue >0) {
if (msg.wParam == PBT_APMRESUMESUSPEND) {
int messBoxID = MessageBox(
NULL,
(LPCTSTR)"Back from suspend.",
(LPCTSTR)"Suspension",
MB_ICONWARNING | MB_CANCELTRYCONTINUE);
}
}
}
return 0;
}
//---------------------------------------------------------------------------
Unfortunately, it doesn't work. The documentation states that the
WM_POWERBROADCAST is sent to all applications, but does it actually mean all
Windowed applications? Or am I just doing something silly?
Thanks,
John B
You can ask on specialized Win32 api newsgroup :
news://194.177.96.26/comp.os.ms-windows.programmer.win32
where it has already been discussed...
JB
"Lafi" <la...@lst.com> wrote in message
news:gcq0p6$l9g$1...@news.albasani.net...