Sign in to follow this  
Followers 0
forever

Screen off/on

3 posts in this topic

is there a way to turn the screen off for some seconds ?

and turn it on then..? so a toggle or so?

anyone? perhaps a 3-party-tools?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Opt("WinTitleMatchMode', 4)

$WM_SYSCommand = 274
$SC_MonitorPower = 61808
$Power_On = -1
$Power_Off = 2
$X = 1

$HWND = WinGetHandle('classname=Progman')

While 1
   If $X = 1 Then
      $X = 0
      DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND, "int", $WM_SYSCommand, "int", _
      $SC_MonitorPower, "int", $Power_Off)
   Else
      $X = 1
      DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND, "int", $WM_SYSCommand, "int", _
      $SC_MonitorPower, "int", $Power_On)
   EndIf
   Sleep(10000)
WEnd

I wrote a tidyer version of the above somewhere on the forums but can't seem to find it. The above should work.

Edit: Found it...

http://www.autoitscript.com/forum/index.ph...topic=11122&hl=

Edited by Burrup

[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

made it into a function for you lazy nubs :)

Func _MonitorPower($i_Power)
    
    If $i_Power <> 0 AND $i_Power <> 1 Then
        SetError(1)
        return 0
    EndIf
    
    Local $ai_PowerState[2] = [2, -1]
    
    Local $i_WTMM = Opt("WinTitleMatchMode", 4)
    
    DllCall("user32.dll", "int", "SendMessage", "hwnd", WinGetHandle('classname=Progman'), "int", 274, "int", 61808, "int", $ai_PowerState[$i_Power])
    
    Opt("WinTitleMatchMode", $i_WTMM)
    
    return 1
    
EndFunc


;ConsoleWrite(_MonitorPower(0) & @LF)
;Sleep(10000)
;ConsoleWrite(_MonitorPower(1) & @LF)

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Share this post


Link to post
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
Sign in to follow this  
Followers 0