tatane Posted June 28, 2018 Posted June 28, 2018 (edited) Hi, As title says, my script doesn't receive ENDSESSION messages when running as service. I'm sorry, I can't put an example but this is what I use : _WinAPI_SetProcessShutdownParameters(0x3FF) ... Global $hGui = GUICreate("") Global Const $WM_QUERYENDSESSION = 0x11 GUIRegisterMsg($WM_QUERYENDSESSION, "onShutDownQuery") Global Const $WM_ENDSESSION = 0x16 GUIRegisterMsg($WM_ENDSESSION, "onShutDownEnd") ... Func onShutDownQuery($hWndGUI, $MsgID, $WParam, $LParam) log("query") Return False EndFunc Func onShutDownEnd($hWndGUI, $MsgID, $WParam, $LParam) ; cleanup ressources $bool_exit = True Return False EndFunc Should I use something else to detect shutdown/reboot/logoff and make some cleanup before ? Thanks. EDIT : I guess this is the cause of my problem https://docs.microsoft.com/fr-fr/windows/desktop/Services/interactive-services Edited June 28, 2018 by tatane
Danyfirex Posted June 28, 2018 Posted June 28, 2018 Hello Maybe this helps. Saludos tatane 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
tatane Posted June 28, 2018 Author Posted June 28, 2018 Thanks Danyfirex. The service part is what I need ! It was easier than I thought. I added my cleanup code in _service_control() function where $SERVICE_CONTROL_STOP and $SERVICE_CONTROL_SHUTDOWN are tested. Danyfirex 1
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