Jump to content

Launch Screensaver


Aassdd
 Share

Recommended Posts

Are there any commands for the monitor?

I was writing a screeensaver and I was hoping it would support those using more than one monitor. I couldn't test their scripts because I only have one monitor. But if you search the forum this way:

+screensaver +dual +monitor

you should find where someone is working on a way to get your screensaver script to recognize multiple monitors.

But if you are looking for a way to just turn off a monitor programmatically, someone else even found a way to do that - it's on the forums somewhere.

Edited by Squirrely1

Das Häschen benutzt Radar

Link to comment
Share on other sites

The usual way of doing this is using Control Panel > Power Options > Turn off monitor dropdown set to 1 hour,

but you could use Control Panel > Display Properties > Screensaver tab > use "Blank" screensaver and set timeout.

To turn off the monitor programmatically, the following function has been available for several months, here on the AutoIt forums. This is my version. Turns off the monitor by default, but as it happens, the monitor comes back on upon user input - keyboard or mouse. There is probably a way, using WMI or something, to make this function work on multi-monitor setups:

#region test_harness
_MonitorToggle()
#endregion
Func _MonitorToggle($OnOff = 0)
; Turns off the monitor by default, but as it happens, monitor comes back on upon user input - keyboard or mouse
    Local $opt = Opt("WinTitleMatchMode", 4)
    Local $opt
    Local $hWnd
    Local $Param
    Local $SC_MonitorPower
    Local $WM_SYSCommand
    If $OnOff = 0 Then
        $Param = 2
    Else
        $Param = -1
    EndIf
    $hWnd = WinGetHandle("classname=Progman")
    $WM_SYSCommand = 274
    $SC_MonitorPower = 61808
    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWnd, _
            "int", $WM_SYSCommand, "int", $SC_MonitorPower, "int", $Param)
    Opt("WinTitleMatchMode", $opt)
EndFunc;==>_MonitorToggle

I think Valik or one of the other developers wrote it - Thanks guys!

Edited by Squirrely1

Das Häschen benutzt Radar

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...