sir Posted October 5, 2006 Share Posted October 5, 2006 how to let start program just after wake up from hibernate? Link to comment Share on other sites More sharing options...
Developers Jos Posted October 5, 2006 Developers Share Posted October 5, 2006 expandcollapse popup#include <GUIConstants.au3> ;~ #define PBT_APMQUERYSUSPEND 0x0000 ;~ #define PBT_APMQUERYSTANDBY 0x0001 ;~ #define PBT_APMQUERYSUSPENDFAILED 0x0002 ;~ #define PBT_APMQUERYSTANDBYFAILED 0x0003 ;~ #define PBT_APMSUSPEND 0x0004 ;~ #define PBT_APMSTANDBY 0x0005 ;~ #define PBT_APMRESUMECRITICAL 0x0006 ;~ #define PBT_APMRESUMESUSPEND 0x0007 ;~ #define PBT_APMRESUMESTANDBY 0x0008 ;~ #define PBTF_APMRESUMEFROMFAILURE 0x00000001 ;~ #define PBT_APMBATTERYLOW 0x0009 ;~ #define PBT_APMPOWERSTATUSCHANGE 0x000A ;~ #define PBT_APMOEMEVENT 0x000B ;~ #define PBT_APMRESUMEAUTOMATIC 0x0012 ; Global $WM_POWERBROADCAST = 536 Global $PBT_APMRESUMESUSPEND = 0x0007 $hGUI = GUICreate("Test", 100, 100,1,1) GUIRegisterMsg($WM_POWERBROADCAST, "Standby") GUISetState() While 1 $GUIMsg = GUIGetMsg() Switch $GUIMsg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; Exit ; Func Standby($hWnd, $Msg, $wParam, $lParam) If $wParam = $PBT_APMRESUMESUSPEND Then MsgBox(0,"Hello Back", " You just woke up") EndIf EndFunc SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
tresa Posted October 5, 2006 Share Posted October 5, 2006 Hi, In the help file they say Warning: blocking of running user functions which executes window messages with commands such like "Msgbox()" can lead to unexpected behavior, the return to the system should be as fast as possible !!! so it's better to put the msgbox in the main loop like this : expandcollapse popup#include <GUIConstants.au3> ;~ #define PBT_APMQUERYSUSPEND 0x0000 ;~ #define PBT_APMQUERYSTANDBY 0x0001 ;~ #define PBT_APMQUERYSUSPENDFAILED 0x0002 ;~ #define PBT_APMQUERYSTANDBYFAILED 0x0003 ;~ #define PBT_APMSUSPEND 0x0004 ;~ #define PBT_APMSTANDBY 0x0005 ;~ #define PBT_APMRESUMECRITICAL 0x0006 ;~ #define PBT_APMRESUMESUSPEND 0x0007 ;~ #define PBT_APMRESUMESTANDBY 0x0008 ;~ #define PBTF_APMRESUMEFROMFAILURE 0x00000001 ;~ #define PBT_APMBATTERYLOW 0x0009 ;~ #define PBT_APMPOWERSTATUSCHANGE 0x000A ;~ #define PBT_APMOEMEVENT 0x000B ;~ #define PBT_APMRESUMEAUTOMATIC 0x0012 ; Global $WM_POWERBROADCAST = 536 Global $PBT_APMRESUMESUSPEND = 0x0007 Global $SortieDeVeille=0 $hGUI = GUICreate("Test", 100, 100,1,1) GUIRegisterMsg($WM_POWERBROADCAST, "Standby") GUISetState() While 1 if $SortieDeVeille=1 Then $SortieDeVeille=0 MsgBox(0,"Réveil", "Vous étiez en veille !") EndIf $GUIMsg = GUIGetMsg() Switch $GUIMsg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; Exit ; Func Standby($hWnd, $Msg, $wParam, $lParam) If $wParam = $PBT_APMRESUMESUSPEND Then $SortieDeVeille=1 EndIf EndFunc hope this help 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