For quite a while I have been using this procedure to keep PC's awake during program run.
Code: Select all
#ES_CONTINUOUS = $80000000
#ES_DISPLAY_REQUIRED = $00000002
#ES_SYSTEM_REQUIRED = $00000001
; ### Prevent Sleep
Procedure Set_SetThreadExecutionState( Flag.l )
Define ReturnValue.l
If OpenLibrary(0, "kernel32")
ReturnValue.l = CallFunction(0, "SetThreadExecutionState", Flag )
If ReturnValue.l = 0
MessageRequester( "Error", "Lib call Failed" )
EndIf
CloseLibrary(0)
Else
MessageRequester( "Error", "Lib open Failed" )
EndIf
EndProcedure
; ### Set to non-SLEEP
Set_SetThreadExecutionState(#ES_CONTINUOUS | #ES_DISPLAY_REQUIRED | #ES_SYSTEM_REQUIRED)
The procedure still works on 64bit but I would like to know if there is a 64bit way of doing the same.
Thanks