如何以编程方式更改第三个监视器 [英] How to change 3rd monitor programmatically

查看:21
本文介绍了如何以编程方式更改第三个监视器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用笔记本电脑时,我使用 3 个显示器:

When I'm using my laptop, I use 3 displays:

  1. 笔记本电脑显示屏
  2. 第二台显示器(通过 VGA 连接)
  3. 一台电视(通过 HDMI 连接)

我的显卡不支持 3 台显示器,所以我经常从 2 台切换到 3 台:当我在电脑上时,我使用第二台显示器,当我想看一些电影等时,我使用第三个.

My videocard doesn't support 3 monitors, so I'm constantly switching from 2 to 3: when I'm on the computer, I use the 2nd monitor, and when I want to watch some movies, etc. I use the 3rd.

我目前必须转到屏幕分辨率,选择未使用的显示器,然后选择将桌面扩展到此显示器.

I currently have to go to Screen Resolution, select the monitor that is not in use, and choose Extend desktop to this display.

有什么方法可以自动化吗?

是否有任何命令行工具或任何允许执行此操作的 Windows API?

Is there any command-line tool, or any Windows API that allows doing it?


Display Changer 似乎可以满足我的需求,但问题是它只能检测正在工作的显示器.未检测到第三台显示器(当前未使用),因此无法附加.


Display Changer seems to do what I need, but the problem is that it only detects the working monitors. The 3rd monitor (which isn't currently in use) isn't detected, so I can't attach it.

推荐答案

DisplaySwitch.exe 上的一点 RE 显示它调用了

A bit of RE on DisplaySwitch.exe shows that it calls

SetDisplayConfig(0, NULL, NULL, NULL, 0x888)

在我的计算机上将其设置为扩展.

to set it to Extended on my computer.

从那里开始,稍微挖掘一下,我就找到了 SetDisplayConfig 文档以及 此 SO 页面 带有一些示例代码,用于查询您当前的显示状态并添加实际标志以根据需要更改它们.

From there, a little digging around got me to the SetDisplayConfig documentation obviously and also this SO page with some example code that queries your current display state and adds the actual flags to change them if you want to do so.

这篇关于如何以编程方式更改第三个监视器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆