Moin!
Vielleicht reicht dir sowas schon als Ansatz ohne
WMI:
Einfach eine App mit einer ListBox drauf (lbMonitorList) und dort dann folgendes in's FormCreate:
Delphi-Quellcode:
procedure TForm1.FormCreate(Sender: TObject);
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;
MfG
Muetze1