dantay9 Posted February 7, 2009 Share Posted February 7, 2009 (edited) I have a working code except for the fact that when the shutdown is intercepted, the shutdown is aborted, but the run function won't work. The whole script exits before it can be called. Is the computer shutting down the script before the abort function is called? $WM_QUERYENDSESSION = 0x0011 GUIRegisterMsg($WM_QUERYENDSESSION, "Intercept_Shutdown") GUICreate("PreventShutdownGUI") GUISetState(@SW_HIDE) Global $b_ShutdownInitiated = False While 1 If $b_ShutdownInitiated = True Then RunWait('"' & @ComSpec & '" \c shutdown -a', '', @SW_HIDE) Run("C:\Documents and Settings\All Users\Shutdown\Run On Shutdown.exe") EndIf Sleep(5) WEnd Func Intercept_Shutdown() $b_ShutdownInitiated = True Return False EndFunc ;==>Intercept_Shutdown Edited February 7, 2009 by dantay9 Link to comment Share on other sites More sharing options...
Authenticity Posted February 7, 2009 Share Posted February 7, 2009 I think it works only if the shutdown process is scheduled, like shutdown -t 60, so shutdown -a just aborts it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now