如何制作克隆或扩展模式

发布于 2024-09-16 15:44:04 字数 126 浏览 4 评论 0原文

我有多个显示器(虚拟+真实),默认情况下我想从我的程序将其置于克隆/双模式。有人可以建议我如何实现这一目标吗?我对这个世界很陌生:)对于这个基本问题感到抱歉......即使任何文档或任何链接都将非常值得赞赏。

/萨博吉特

I am having multiple monitors(virtual+real) and by default I wanted to put it in clone/dual mode from my program. Can some one suggest how do I achieve this? I am very new to this world:) sorry for this basic question.... even any doc or any link will be highly appreciable.

/sarbojit

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

人疚 2024-09-23 15:44:05
//Extend
SetDisplayConfig(0, NULL,0, NULL,(SDC_APPLY | SDC_TOPOLOGY_EXTEND));
//Clone
SetDisplayConfig(0, NULL,0, NULL,(SDC_APPLY | SDC_TOPOLOGY_CLONE));

有关详细信息:http://msdn.microsoft .com/en-us/library/ff569533%28v=VS.85%29.aspx

//Extend
SetDisplayConfig(0, NULL,0, NULL,(SDC_APPLY | SDC_TOPOLOGY_EXTEND));
//Clone
SetDisplayConfig(0, NULL,0, NULL,(SDC_APPLY | SDC_TOPOLOGY_CLONE));

For more information: http://msdn.microsoft.com/en-us/library/ff569533%28v=VS.85%29.aspx

策马西风 2024-09-23 15:44:05

在Win7中设置克隆显示,如果有2个路径和4个模式,这将起作用

UINT32 cPath=0;  //path count
UINT32 cMode=0;  //mode count
HRESULT hr;
hr = GetDisplayConfigBufferSizes(QDC_ALL_PATH, &cPath, &cMode);
std::vector<DISPLAYCONFIG_PATH_INFO> pathArray(cPath);
std::vector<DISPLAYCONFIG_MODE_INFO> modeArray(cMode);
hr =QueryDisplayConfig(QDC_ALL_PATHS, &cPath, &pathArray[0], &cMode, &modeArray[0], NULL);
if(hr != ERROR_SUCCESS) { problem in paradise }
if(cPath!=2 || cMode != 4) { anything else is too complex or a single display or already cloned }
// to change resolution also
// int ix=pathArray[0].sourceInfo.modeInfoIdx;  assuming path[0] is primary, it should be
// modeArray[ix].sourceMode.width = 320;       // :(
// modeArray[ix].sourceMode.hieght = 240;      // :(
pathArray[1].flags |= DISPLAYCONFIG_PATH_ACTIVE;
pathArray[1].sourceInfo.modeIdx = pathArray[0].sourceInfo.modeIdx;   //same source
pathArray[1].sourceInfo.id = pathArray[0].sourceInfo.id;       //same source
hr = SetDisplayConfig(cPath, &pathArray[0], cMode, &modeArray[0], SDC_APPLY | SDC_USE_SUPPLIED_DISPLAY_CONFIG | SDC_ALLOW_CHANGE | SDC_SAVE_TO_DATABASE));
if(hr != ERROR_SUCCESS) { so close!!! }

To set clone displays in Win7, this will work if there are 2 paths and 4 modes

UINT32 cPath=0;  //path count
UINT32 cMode=0;  //mode count
HRESULT hr;
hr = GetDisplayConfigBufferSizes(QDC_ALL_PATH, &cPath, &cMode);
std::vector<DISPLAYCONFIG_PATH_INFO> pathArray(cPath);
std::vector<DISPLAYCONFIG_MODE_INFO> modeArray(cMode);
hr =QueryDisplayConfig(QDC_ALL_PATHS, &cPath, &pathArray[0], &cMode, &modeArray[0], NULL);
if(hr != ERROR_SUCCESS) { problem in paradise }
if(cPath!=2 || cMode != 4) { anything else is too complex or a single display or already cloned }
// to change resolution also
// int ix=pathArray[0].sourceInfo.modeInfoIdx;  assuming path[0] is primary, it should be
// modeArray[ix].sourceMode.width = 320;       // :(
// modeArray[ix].sourceMode.hieght = 240;      // :(
pathArray[1].flags |= DISPLAYCONFIG_PATH_ACTIVE;
pathArray[1].sourceInfo.modeIdx = pathArray[0].sourceInfo.modeIdx;   //same source
pathArray[1].sourceInfo.id = pathArray[0].sourceInfo.id;       //same source
hr = SetDisplayConfig(cPath, &pathArray[0], cMode, &modeArray[0], SDC_APPLY | SDC_USE_SUPPLIED_DISPLAY_CONFIG | SDC_ALLOW_CHANGE | SDC_SAVE_TO_DATABASE));
if(hr != ERROR_SUCCESS) { so close!!! }
妖妓 2024-09-23 15:44:05

如果您碰巧使用的是 Windows XP 并且拥有 NVIDIA 卡,您可以使用以下命令行命令

rundll32.exe NvCpl.dll,dtcfg setview 1 clone

rundll32.exe NvCpl.dll,dtcfg setview 1 dualview

使用 CreateProcess 创建一个运行该命令的子进程。我无法让 NvAPI 在 Windows XP 上设置克隆或扩展模式,但它似乎在 Windows 7 上运行良好。

If you happen to be on Windows XP and have an NVIDIA card you can use the following command line command

rundll32.exe NvCpl.dll,dtcfg setview 1 clone

or

rundll32.exe NvCpl.dll,dtcfg setview 1 dualview

and use CreateProcess to create a child process which runs that command. I have been unable to get NvAPI to set up clone or extended mode on Windows XP, but it seems to run fine on Windows 7.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文