tankmann Posted September 6, 2007 Share Posted September 6, 2007 Hi all, I've written a little Login-GUI that's permanently on top to have a windows-independent Login. It has to work with NT4 and XP. The Script prevents starting some programs while not logged in. It runs as a service. To ensure that the login-GUI is always available, I've written a second small script that just checks if the login-GUI process exists and in case of the non-existance it will be restarted. This runs as a service,too. So far so good - that works. But when Windows is shutting down, my second process always tries to restart the login-GUI - that results in a lot of error messages from Windows. So I tried the following within the code of my Login-GUI to prevent a restart in case of a shutdown: Func OnAutoItExit() If @exitMethod = 4 Then Run("net stop Login-restarter","",@SW_HIDE) Endif EndFunc Unfortunately, this doesn't work. Has anybody any idea how to solve that? Link to comment Share on other sites More sharing options...
evilertoaster Posted September 6, 2007 Share Posted September 6, 2007 Does anything run during your onexit event? Just trying to see if it's that the event isn't running or if your net stop function isn't working. Maybe when windows is shutting down the service required for 'net' commands to work has already stoped? Link to comment Share on other sites More sharing options...
ChrisL Posted September 7, 2007 Share Posted September 7, 2007 (edited) Try this..$WM_QUERYENDSESSION = 0x0011 GUICreate("ShutDownNotificationGui") GUIRegisterMsg($WM_QUERYENDSESSION, "_ShutdownInitiated") GUISetSTate(@SW_HIDE) While 1 sleep(10) WEnd Func _ShutdownInitiated($hWndGUI, $MsgID, $WParam, $LParam) ProcessClose("the other process that is relaunching this app.exe");or the net stop thing you posted above RunWait("net stop Login-restarter","",@SW_HIDE) Return True EndFuncEdit: Also you say you have a process that watches your main app, is this any easier http://www.autoitscript.com/forum/index.php?showtopic=48614 Edited September 7, 2007 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
tankmann Posted September 10, 2007 Author Share Posted September 10, 2007 Try this.. $WM_QUERYENDSESSION = 0x0011 GUICreate("ShutDownNotificationGui") GUIRegisterMsg($WM_QUERYENDSESSION, "_ShutdownInitiated") GUISetSTate(@SW_HIDE) While 1 sleep(10) WEnd Func _ShutdownInitiated($hWndGUI, $MsgID, $WParam, $LParam) ProcessClose("the other process that is relaunching this app.exe");or the net stop thing you posted above RunWait("net stop Login-restarter","",@SW_HIDE) Return True EndFunc Edit: Also you say you have a process that watches your main app, is this any easier http://www.autoitscript.com/forum/index.php?showtopic=48614 Thanks, that's exactly what I needed :-) Works perfectly! 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