mric5180
asked on
Multiple Montitor Programming
Hi,
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(di splay_devi ce.DeviceN ame, &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?
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(di
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You are able to get the state of the screen saver running using SystemParametersInfo like so:
SystemParametersInfo(SPI_G
you can check to see if it's been switched from running to not running on a timer and then re-do your code...
also you can trap the WM_SYSCOMMAND message and check for a wparam of SC_SCREENSAVE ... this gets sent to all top-level windows when the screen saver is being activated... you can process this message by returning FALSE to stop the screen saver from kicking in.
maybe more research into those leads will yield your answer.