Programmatically change screen resolution?

前端 未结 4 887
感动是毒
感动是毒 2020-11-28 12:20

Is there a way to programmatically change the screen resolution or enable/disable multiple monitors in Windows XP? For example to change from 1024x768 with one monitor to 1

4条回答
  •  天命终不由人
    2020-11-28 12:52

    You can easily script this with http://www.autohotkey.com

    Here's a script for swapping between one monitor and two monitors with Windows+1 and Windows+2

    #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
    #Warn  ; Recommended for catching common errors.
    SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
    SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
    #1::
    Send {LWin}
    WinWaitActive Start menu
    Send Adjust Screen Resolution
    Send {enter}
    WinWaitActive Screen Resolution
    ControlClick ComboBox3
    Send {PgDn}
    Send {Up} ; Select "Show desktop only on 1"
    Send {enter}
    Sleep 3000 ; workaround - cannot select accept/revert window?
    Send {left}
    Send {enter} ; accept changes
    Return
    #2::
    Send {LWin}
    WinWaitActive Start menu
    Send Adjust Screen Resolution
    Send {enter}
    WinWaitActive Screen Resolution
    ControlClick ComboBox3
    Send {PgDn}
    Send {Up}
    Send {Up} ; Select "Extend these displays"
    Send {enter}
    Sleep 3000 ; workaround - cannot select accept/revert window?
    Send {left}
    Send {enter} ; accept changes
    Return
    

提交回复
热议问题