Jump to content

[SOLVED]Not receiving WM_QUERYENDSESSION messages when script run as service


Recommended Posts

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 by tatane
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...