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 


Hook Windows Logoff/Shutdown Event

 
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: Sun Nov 15, 2009 10:13 pm    Post subject: Hook Windows Logoff/Shutdown Event Reply with quote

Is there any way to hold up Windows from shutting down until your program
closes? For example, when a user logs off or shuts down the computer, the
program will hold up the event and pop up a message box which will ask the
user something?

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1565

PostPosted: Mon Nov 16, 2009 4:59 am    Post subject: Reply with quote

I'm not sure in VDS but the Windows api uses WM_QUERYENDSESSION message sent to your window.

http://msdn.microsoft.com/en-us/library/aa376890(VS.85).aspx


If you return a value of false when Windows sends you this message then Windows will not shutdown and wait for your app. It will keep sending this message until your app or any other all return true to allow shutdown.

You likely can use gadgetx to intercept and return a value back to this windows api message.
Back to top
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Mon Nov 16, 2009 12:40 pm    Post subject: Reply with quote

Awesome, thanks! This looks like it will be just the thing.
_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Mon Nov 16, 2009 10:33 pm    Post subject: Reply with quote

FreezingFire,
I tried to make this work with GadgetX a long time ago and never could get the Return value to stick. This is due to VDS being single threaded and it's event callback function does not allow the user to return a value to the callee. I may give it another shot since you are asking.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
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