EDN Admin
Well-known member
Hi everyone.
Ive been searching for detecting when Windows XP start to shutdown or logoff.
What I want to do:
Bring a window (my form) and ask if you want to continue closing (shutdown or logoff); if not, return to windows.
But the PROBLEM is that other programs close first! before my application detects the closing (shutdown).
What Ive done for detection:
1. Override the WndProc inside the form and ask m.Msg == WM_QUERYENDSESSION.
2. On Form closing event ask e.CloseReason == CloseReason.WindowsShutDown.
3. SystemEvents.SessionEnding event works but just when my app has been focus to be close by the shutdown. It still close other programs before mine asks.
- I use the command "shutdown -a" for stopping from shutdown.
Please help me. I dont know "hooks" but it seems that i need them for detecting at real time, just exactly when the shutdown has started. I either dont know services but i dont know if you can show a window this way.
Thank you very much.
View the full article
Ive been searching for detecting when Windows XP start to shutdown or logoff.
What I want to do:
Bring a window (my form) and ask if you want to continue closing (shutdown or logoff); if not, return to windows.
But the PROBLEM is that other programs close first! before my application detects the closing (shutdown).
What Ive done for detection:
1. Override the WndProc inside the form and ask m.Msg == WM_QUERYENDSESSION.
2. On Form closing event ask e.CloseReason == CloseReason.WindowsShutDown.
3. SystemEvents.SessionEnding event works but just when my app has been focus to be close by the shutdown. It still close other programs before mine asks.
- I use the command "shutdown -a" for stopping from shutdown.
Please help me. I dont know "hooks" but it seems that i need them for detecting at real time, just exactly when the shutdown has started. I either dont know services but i dont know if you can show a window this way.
Thank you very much.
View the full article