| View previous topic :: View next topic |
| Author |
Message |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Sun Nov 15, 2009 10:13 pm Post subject: Hook Windows Logoff/Shutdown Event |
|
|
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 |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1565
|
Posted: Mon Nov 16, 2009 4:59 am Post subject: |
|
|
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 |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Mon Nov 16, 2009 12:40 pm Post subject: |
|
|
Awesome, thanks! This looks like it will be just the thing. _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Nov 16, 2009 10:33 pm Post subject: |
|
|
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 |
|
 |
|