I have written a program to detach a 2nd display from the desktop programatically (ie not using the control panel display settings).
The relvant lines of code to do this are shown below.
video_mode.dmFields = DM_POSITION | DM_PELSWIDTH | DM_PELSHEIGHT ;
video_mode.dmPelsHeight = 0; // pixel height & width of the screen,
video_mode.dmPelsWidth = 0; // both must be 0 to detach from desktop
rtn1 = ChangeDisplaySettingsEx(display_device.DeviceName, &video_mode, NULL, CDS_UPDATEREGISTRY, NULL);
THis works and detaches the monitor from the desktop and i can get a handle to the screen and draw to it no problems. The problem is however when the screen saver comes on. When the screen saver comes on, the second display, which i detached from the desktop using my software, re-attaches itself to the dektop when the screen saver goes off. This is obviously undesired since i want my process to have sole control over what goes onto that screen at all times screen saver or not.
Does anyone have any suggestions as to how to keep control of the second independant display after the screen saver?