Jump to content

Notification of the transition to standby or hibernate mode.


AndreyS
 Share

Recommended Posts

Jos suggested in one of the themes the following code:

#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <Date.au3>
Global $PBT_APMSUSPEND = 0x0004
Global $PBT_APMRESUMESUSPEND = 0x0007
Global $PBT_APMSTANDBY = 0x0005
Global $PBT_APMRESUMESTANDBY = 0x0008
Dim $hGUI = GUICreate("Test", 100, 100,1,1) ;You need to work without this line.
GUIRegisterMsg($WM_MOUSEWHEEL, "Standby")
Func Standby($hWnd, $Msg, $wParam, $lParam)
    ConsoleWrite(_NowTime() & ": " & $wParam & @LF)
    Select
        Case $wParam = $PBT_APMSUSPEND
            ConsoleWrite(" You going into Suspend." & @LF)
        Case $wParam = $PBT_APMRESUMESUSPEND
            ConsoleWrite(" You just woke up from Suspend." & @LF)
        Case $wParam = $PBT_APMSTANDBY
            ConsoleWrite(" You are going into Standby." & @LF)
        Case $wParam = $PBT_APMRESUMESTANDBY
            ConsoleWrite(" You just woke up from Standby." & @LF)
        Case Else
    EndSelect
EndFunc

My application does not use any windows. It has only a menu in the tray. Tell me, who knows how to make this code work in my case.
Thank you!

Link to comment
Share on other sites

Well, yes, it's like an option to make a small window and not display it. But I thought there is still a code more suitable for my situation and more correct in terms of programming.

I'm very grateful to you, Jos, that you responded immediately!

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

×
×
  • Create New...