Reputation: 386
I am trying to stretch a desktop to two monitors using the ChangeDisplaySettingsEx function. I want the desktop resolution to be 3840x1080 instead of 1920x1080 resolution. I tried the following:
POINTL posPrimary={0};
posPrimary.x=0
posPrimary.y=0;
DEVMODE mode_primary = {0};
mode_primary.dmSize = sizeof(mode_primary);
mode_primary.dmFields = DM_POSITION;
mode_primary.dmPosition = posPrimary;
mode_primary.dmPelsWidth = 3840;
mode_primary.dmPelsHeight = 1080;
LONG status = ChangeDisplaySettingsEx(
nameofMonitor,
&mode_primary,
nullptr, // reserved
CDS_SET_PRIMARY | CDS_UPDATEREGISTRY,
nullptr // no video parameter
);
if (DISP_CHANGE_SUCCESSFUL != status) {
printf("ChangeDisplaySettingsEx returned %d", status);
return -__LINE__;
}
I also tried the SetDisplayConfig function:
SetDisplayConfig(0,NULL,0,NULL,SDC_TOPOLOGY_CLONE|SDC_APPLY);
SDC_TOPOLOGY_CLONE just clones the monitors while SDC_TOPOLOGY_EXTEND extends the desktop to the second display.
Any suggestions would be appreciated.
Upvotes: 0
Views: 2447
Reputation: 608
The other option is to use a device like SAPPHIRE Vid-2X or Matrox 2H2Go. These will include 3840x1080 in their EDID so you can use SetDisplayConfig to setup 1920x1080 and you will get cloned diwplays or setup 3840x1080 to get one desktop stretched across both displays. This way you are graphics card/vendor agnostic. Note that you need DL-DVI or DP to make this work.
Upvotes: 0
Reputation: 32596
Windows 7 does not support "stretching" the desktop across multiple monitors. You can extend the desktop across multiple monitors, but you always have to pick which monitor will be the primary monitor. The task bar appears on the primary monitor and there is no way to have it stretch across to other monitors.
Windows 8 has much better multi-monitor support, and allows a task bar on each monitor. You can configure the same task bar to be on all screens, or individual task bars with the icons for the windows on that screen. AFAIK, you still can't have a single task bar stretched across all monitors.
Update
I was thinking a little more about this, and it occurred to me that it may be possible for a video card driver to present multiple monitors to Windows as a single device with the combined resolution. This configuration would be proprietary to the video card vendor, and you'd have to use their APIs to access the capability, if indeed it exists.
Upvotes: 1