Jump to content
Flirc Forums

[Windows] How to switch between two monitors with one click


Godzilla

Recommended Posts

Here is how you switch between two monitors (e. g. TFT and Plasma TV) with one click on my remote.

my setup:

  • Win7 desktop
  • TFT-monitor (DVI)
  • Plasma TV (HDMI)

    First you download and instell a little commandline-tool called "Display Changer".
    http://12noon.com/?page_id=80

    Then let Display Changer list the available monitors
    
    dc64.exe -listmonitors
    
    
    post-945-0-34725400-1337800278_thumb.png The current monitor is "\\.\DISPLAY1". (I am not sure, but it seems Display1 is always the current one. Otherwise my script would not work.) So, what we want the script to do, is to set the second dosplay as acive and deactivate the current one. And we don't want to keep the current resolution (1680x1050 px) since the Plasma TV is FullHD (1920x1080 px). Instead we always want to use the native (read maximum) resolution. (same for colordepth and refreshrate) So we need one command to set the second display to be the primary one. (DisplayCharger is able to configure and arrange many monitors at the same time)
    
    dc64cmd.exe -monitor="\\.\DISPLAY2" -width=max -height=max -refresh=max -depth=max -primary
    
    
    And another command to disable the current monitor.
    
    dc64cmd.exe -monitor="\\.\DISPLAY1" -detach
    
    
    Display Changer is able to "remember" the first command and executes it not before we told it all our commands. So we add "-more" to the first line and "-apply" to the second. (This may be bad english. Sorry.) My final script looks like this:
    
    cd "C:\Program Files\12noon Display Changer\"
    
    dc64cmd.exe -monitor="\\.\DISPLAY2" -more -width=max -height=max -refresh=max -depth=max -primary
    
    dc64cmd.exe -monitor="\\.\DISPLAY1" -apply -detach
    
    


    Just save it as "switch_monitors.cmd", so you can doubleclick it to try it out.

    Everytime you execute the script the other monitor should become the active monitor.

    To execute this script by pressing a button on your remote, you first need to create a link to the script on your desktop.
    post-945-0-98729400-1337799973_thumb.png
    To create a link you just drag'n'drop the script while holding the ALT-key.

    Right-click the shortcut and select properties.
    Click on the field next to "Shortcut" and press your preferred key-combination (e.g. Ctrl+Shift+M)
    post-945-0-73550100-1337800280_thumb.png
    (Can anyone provide an english screenhot?)

    Click OK and try out the new hotkey. :)

    The last step is to map a button on your remote the the selected key-combination.
    I think you know how to do that.

    Good luck.



    advise:

    • Use dc.exe if you don't have a 64-bit system.
    • Remember the options you get when you press Win+P
      With this hotkey (and direction-keys and enter) you are able to switch the monitor arrangement blindly.
      In case you get two black displays. ;)
    • Add "PAUSE" to the end of the script to see any errors while testing

    If you know a better way for switching between two monitors, let me know.

    I am not responsible if anything bad happens!

    Do it at your own risk!

Link to comment
Share on other sites

I have to be honest and say that I didn't read the post carefully, but to switch monitors you can just create a shortcut to "C:\Windows\System32\DisplaySwitch.exe /external".

The four "win+p" choices:

/internal

/clone

/extend

/external

The resolution always stays the same (1366x768 for my laptop, and 1920x1080 for my Plasma TV), even after shutdown/reboot.

BR

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...