Enable secondary monitor

  • Thread starter Thread starter MikeZ
  • Start date Start date
M

MikeZ

Can anyone tell me how to enable a secondary monitor in XPe? I have a
Composite Video out that I am attempting to connect to a TV. I can see
the secondary monitor in Display Properties, but when I try to "Extend
my desktop", the screen flashes but the secondary monitor isn't enabled.
If I go back into Display Properties, it is still unchecked.

I've tried using the following code to enable the secondary monitor with
no luck. Any thoughts or direction is appreciated. Thank you, Mike


BOOL bFoundSecondary = FALSE;

nWidth = this->GetDC()->GetDeviceCaps(HORZRES);

// Initialize DisplayDevice.
ZeroMemory(&DisplayDevice, sizeof(DisplayDevice));
DisplayDevice.cb = sizeof(DisplayDevice);

LONG retCode;

// Get display devices.
while ((EnumDisplayDevices(NULL, DispNum, &DisplayDevice, 0)) &&
(bFoundSecondary == FALSE))
{
ZeroMemory(&defaultMode, sizeof(DEVMODE));
defaultMode.dmSize = sizeof(DEVMODE);
if (!EnumDisplaySettings((LPSTR)DisplayDevice.DeviceName,
ENUM_REGISTRY_SETTINGS, &defaultMode))
return FALSE; // Store default failed

CString errStr;
if (!(DisplayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE))
{
//Found the first secondary device.
bFoundSecondary = TRUE;
defaultMode.dmSize = sizeof(DEVMODE);
defaultMode.dmPosition.x = nWidth;
defaultMode.dmPosition.y = 0;
defaultMode.dmFields = DM_POSITION;
VIDEOPARAMETERS vp = {0};
vp.Guid = GUID_VIDEOPARAMETERS;
vp.dwCommand = VP_COMMAND_SET;
vp.dwFlags = VP_FLAGS_TV_MODE | VP_FLAGS_TV_STANDARD;
vp.dwMode = VP_MODE_TV_PLAYBACK;
vp.dwTVStandard = VP_TV_STANDARD_NTSC_M;
retCode = ChangeDisplaySettingsEx(
(LPSTR)DisplayDevice.DeviceName, &defaultMode, NULL,
CDS_VIDEOPARAMETERS|CDS_NORESET|CDS_UPDATEREGISTRY,
&vp);
if (retCode != DISP_CHANGE_SUCCESSFUL)
{
errStr.Format("POS: %ld", retCode);
MessageBox(errStr);
}

// A second call to ChangeDisplaySettings updates the monitor.
retCode = ChangeDisplaySettings(NULL, 0);
if (retCode != DISP_CHANGE_SUCCESSFUL)
{
errStr.Format("RESET: %ld", retCode);
MessageBox(errStr);
}
}

// Reinitialize DisplayDevice.
ZeroMemory(&DisplayDevice, sizeof(DisplayDevice));
DisplayDevice.cb = sizeof(DisplayDevice);
DispNum++;
} // End while the display devices.
 
I don't know if it's related but I'm trying to drive a monitor with
composite video and I find that if I don't have the monitor attached a
boot the video output is switched off by the video card, a 6600 PCIe.
nVidia (chipset/driver manufacturer) and Gigabyte (card manufacturer)
seem content to blame each other.

F.
 
The PC can drive the TV fine because it shows up on the TV during BIOS
boot... but it then disappears when XPe starts. Seems like I'm
missing a driver in XPe. I've installed all the Analog
Television/Generic Television components.
 
I found that I had to make changes to the advanced display properties
settings, I use display clone mode with VGA and TV although I don't
actually fit VGA displays to delivery systems. I have to do this after
FBA because I'm still quite new to XPe and the display drivers get
installed then as well (and I don't know any other way at the moment).
Also, the display drivers supplied with Target Designer/SP2 were not a
close enough match for my system.

F.
 
Back
Top