Moin!
Ist \\.\DISPLAY2 auch der 2. Monitor/Grafikkartenausgang und nicht vielleicht der TV Out Ausgang? Schonmal die Bits zu den Einträgen angeschaut?
Delphi-Quellcode:
Procedure TForm1.FillMonitorList;
Var
Cntr : Cardinal;
Info : TDisplayDevice;
AdapterName : PChar;
OldPos : Integer;
Const
DISPLAY_DEVICE_ATTACHED_TO_DESKTOP = $00000001;
DISPLAY_DEVICE_MULTI_DRIVER = $00000002;
DISPLAY_DEVICE_PRIMARY_DEVICE = $00000004;
DISPLAY_DEVICE_MIRRORING_DRIVER = $00000008;
DISPLAY_DEVICE_VGA = $00000010;
Begin
lbMonitorList.Items.Add('------------------ Displays ----------------');
Cntr := 0;
Info.cb := SizeOf(Info);
While EnumDisplayDevices(Nil, Cntr, Info, 0) Do
Begin
lbMonitorList.Items.Add('* Device '+IntToStr(Cntr)+':');
lbMonitorList.Items.Add(' DeviceName : '+Info.DeviceName);
lbMonitorList.Items.Add(' DeviceString: '+Info.DeviceString);
OldPos := lbMonitorList.Items.Add(' StateFlags: ');
If ( Info.StateFlags And DISPLAY_DEVICE_ATTACHED_TO_DESKTOP ) = DISPLAY_DEVICE_ATTACHED_TO_DESKTOP Then
lbMonitorList.Items.Add(' + Display Device Attached To Desktop')
Else
lbMonitorList.Items.Add(' - Display Device Attached To Desktop');
If ( Info.StateFlags And DISPLAY_DEVICE_MULTI_DRIVER ) = DISPLAY_DEVICE_MULTI_DRIVER Then
lbMonitorList.Items.Add(' + Display Device Multi Driver')
Else
lbMonitorList.Items.Add(' - Display Device Multi Driver');
If ( Info.StateFlags And DISPLAY_DEVICE_PRIMARY_DEVICE ) = DISPLAY_DEVICE_PRIMARY_DEVICE Then
lbMonitorList.Items.Add(' + Display Device Primary Device')
Else
lbMonitorList.Items.Add(' - Display Device Primary Device');
If ( Info.StateFlags And DISPLAY_DEVICE_MIRRORING_DRIVER ) = DISPLAY_DEVICE_MIRRORING_DRIVER Then
lbMonitorList.Items.Add(' + Display Device Mirroring Driver')
Else
lbMonitorList.Items.Add(' - Display Device Mirroring Driver');
If ( Info.StateFlags And DISPLAY_DEVICE_VGA ) = DISPLAY_DEVICE_VGA Then
lbMonitorList.Items.Add(' + Display Device VGA')
Else
lbMonitorList.Items.Add(' - Display Device VGA');
AdapterName := StrAlloc(SizeOf(Info.DeviceName));
StrCopy(AdapterName, Info.DeviceName);
EnumDisplayDevices(AdapterName, 0, Info, 0);
lbMonitorList.Items.Insert(OldPos, ' Monitorname : ' + Info.DeviceString);
StrDispose(AdapterName);
Inc(Cntr);
End;
End;
Mach mal ein Testprogramm und pack den Aufruf da mal mit rein und schau mal nach welche Flags danach in der lbMonitorList ListBox stehen. Das wäre so dies was mir denn dazu noch einfällt. Eine Fehlermeldung kommt auch nicht (so ala falsche Flags o.ä.)??
MfG
Muetze1