|
|
|
date: Thu, 17 Apr 2008 05:04:39 -0700 (PDT),
group: microsoft.public.win32.programmer.gdi
back
Switching primary monitor
I have been trying to use ChangeDisplaySettingsEx() to switch the
primary display device as per the post:
http://groups.google.com/group/microsoft.public.win32.programmer.gdi/msg/f298871db17f2c97
However, it doesn't not work. I'm running it on a Dell Inspiron
laptop with an ATI graphics chip, and running XP, and hoping it will
switch between the LCD screen and the external monitor. The first
call to ChangeDisplaySettingEx fails with DISP_CHANGE_BADMODE, 'The
graphics mode is not supported'.
Any ideas what might be causing it to fail? The essential part of the
code is:
EnumDisplaySettings(devName2, ENUM_REGISTRY_SETTINGS, &dm2);
dm2.dmFields = DM_POSITION;
dm2.dmPosition.x = 0;
dm2.dmPosition.y = 0;
retCode = ChangeDisplaySettingsEx(devName2, &dm2, NULL,
CDS_SET_PRIMARY |
CDS_UPDATEREGISTRY | CDS_NORESET, NULL);
ShowDisplayError("Error in dev2 change", retCode);
EnumDisplaySettings(devName1, ENUM_REGISTRY_SETTINGS, &dm1);
dm1.dmFields = DM_POSITION;
dm1.dmPosition.x = dm2.dmPelsWidth;
dm1.dmPosition.y = 0;
retCode = ChangeDisplaySettingsEx(devName1, &dm1, NULL,
CDS_UPDATEREGISTRY |
CDS_NORESET, NULL);
ShowDisplayError("Error in dev1 change", retCode);
retCode = ChangeDisplaySettings(NULL, 0);
ShowDisplayError("Error in settings change", retCode);
Thanks.
Ian.
date: Thu, 17 Apr 2008 05:04:39 -0700 (PDT)
author: Ian
|
|