I have not been successful. PeekMessage doesn't seem to work at all, and
all I could get GetMessage to catch were menu clicks (my application has a
NotifyIcon, but I never call Show on the main window). To solve my original
problem, I simply have my application write to file each time a setting
changes. An inelegant and inefficient solution, but it works.
I think if something like the following were to be added to the main message
loop in GUI.xs (perhaps between case WM_SYSCOMMAND and case WM_SIZE), it
would work.
case WM_QUERYENDSESSION:
if(GetObjectName(NOTXSCALL hwnd, Name)) {
/*
* (@)EVENT:Shutdown()
* Sent when Windows is about to shut down.
* (@)APPLIES_TO:Window, DialogBox
*/
strcat(Name, "_Shutdown");
PerlResult = DoEvent_Generic(NOTXSCALL Name);
}
break;
Then {WindowName}_Shutdown would be called whenever Windows is about to shut
down. According to what I was able to discover, if an application returns
false, Windows stops the shutdown process. So returning 1 or 0 should work
as expected; I believe returning -1 from your sub would end the Dialog
phase, but that Win32::GUI would then return a 1, so Windows would shut
down.
If anyone wants to test this out (I do not have a compiler), that would be
nice. Perhaps it could be included in the next release if it works. Then,
again, it's only really useful for something that runs during the entire
Windows session, like my application or a daemon, so perhaps it's not really
necessary.
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp