View previous topic :: View next topic |
Author |
Message |
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Sat Mar 19, 2005 3:40 pm Post subject: Abort a system shutdown? |
|
|
Is there a way to, say, create a program which allowed you to abort a
shutting down computer by pressing a key combination? Sometimes I
shut down the computer without realizing that I need to save something
etc., and some way to abort the shutdown would be nice.
I know that you can abort a shutdown using shutdown.exe that comes with
windows, but the problem is that once the system is in shut-down mode,
I can't launch command to stop the shutdown.
I know shutdowns can be intercepted, for example, like if Windows is
shutting down and there is unsaved text in Notepad, Notepad will prompt
you if you would like to save or not. If you click "Cancel", the shutdown is
aborted and everything is back to normal.
Any ideas?
Thanks in advance. _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sat Mar 19, 2005 8:39 pm Post subject: |
|
|
If you can capture the WM_QUERYENDSESSION message
and return zero, that should stop a shutdown.
The capture app would have to be running before the
shutdown of course, and you'd prolly need a query
window (or hotkey it) each time, or Windows would
shut it down as well.
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|
Back to top |
|
|
PGWARE Web Host
Joined: 29 Dec 2001 Posts: 1562
|
Posted: Sat Mar 19, 2005 9:39 pm Post subject: |
|
|
I think if the shutdown is initated by a program it can include the FORCE flag which to my knowledge does not prompt to save any unsaved program data, it just turns Windows off.
But like Mac said WM_QUERYENDSESSION will work for most shutdowns/reboots. |
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sat Mar 19, 2005 10:05 pm Post subject: |
|
|
Prakash is correct about the force flag if an app is using "ExitWindowsEx" to shutdown...
"EWX_FORCE Forces processes to terminate. When this flag is set, Windows does not send the messages WM_QUERYENDSESSION and WM_ENDSESSION to the applications currently running in the system. This can cause the applications to lose data. Therefore, you should only use this flag in an emergency."
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Sun Mar 20, 2005 1:15 am Post subject: |
|
|
Would I be on the right track using OPTION MSGEVENT to capture the
message? How would I cut off the message to the other programs? _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
jules Professional Member
Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Mon Mar 21, 2005 9:05 am Post subject: |
|
|
Hmm. VDS itself processes this message, in order to implement the correct shutdown action for a VDS application, so I doubt if you'd be able to see this message using MSGEVENT, let alone change the return code. You can't define MSGEVENTs for messages that the VDS runtime handles, and the architecture of VDS does not allow information to be returned by a message. _________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
|
|