forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Abort a system shutdown?

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Sat Mar 19, 2005 3:40 pm    Post subject: Abort a system shutdown? Reply with quote

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. Smile

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Sat Mar 19, 2005 8:39 pm    Post subject: Reply with quote

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. Wink

Cheers, Mac Smile

_________________
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
View user's profile Send private message Send e-mail
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1562

PostPosted: Sat Mar 19, 2005 9:39 pm    Post subject: Reply with quote

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
View user's profile Send private message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Sat Mar 19, 2005 10:05 pm    Post subject: Reply with quote

Prakash is correct about the force flag if an app is using "ExitWindowsEx" to shutdown... Wink

"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 Smile

_________________
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
View user's profile Send private message Send e-mail
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Sun Mar 20, 2005 1:15 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Mon Mar 21, 2005 9:05 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group