Disabling the Extend your desktop to this monitor.
Posted on 2004-08-27
I am trying to disable the extended desktop from all the monitors except for the primary one.
I tried using EnumDisplayMonitors() with the function at the end of this message as the callback function.
This seems to move the location of the second display, but it doesn't disable the extended desktop.
Any help is greatly appreciated. I can't believe that there isn't a windows API that can be used to do this.
BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData )
mi.cbSize = sizeof(MONITORINFOEX);
if(!(mi.dwFlags & MONITORINFOF_PRIMARY))
dm.dmSize = sizeof(DEVMODE);
dm.dmDriverExtra = 0;
dm.dmFields = DM_POSITION;
dm.dmPelsHeight = dm.dmPelsWidth = 0;
lStatus = ChangeDisplaySettingsEx(mi.szDevice, &dm, NULL, CDS_TEST, NULL);
if(lStatus == DISP_CHANGE_SUCCESSFUL)
lStatus = ChangeDisplaySettingsEx(mi.szDevice, &dm, NULL, /*CDS_RESET*/CDS_UPDATEREGISTRY, 0);