private
{ Private-Deklarationen }
Procedure FillMonitorList;
//
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
ListBox1.Items.Add('------------------ Displays ----------------');
Cntr := 0;
Info.cb := SizeOf(Info);
While EnumDisplayDevices(Nil, Cntr, Info, 0) Do
Begin
ListBox1.Items.Add('* Device '+IntToStr(Cntr)+':');
ListBox1.Items.Add(' DeviceName : '+Info.DeviceName);
ListBox1.Items.Add(' DeviceString: '+Info.DeviceString);
OldPos := ListBox1.Items.Add(' StateFlags: ');
If ( Info.StateFlags And DISPLAY_DEVICE_ATTACHED_TO_DESKTOP ) = DISPLAY_DEVICE_ATTACHED_TO_DESKTOP Then
ListBox1.Items.Add(' + Display Device Attached To Desktop')
Else
ListBox1.Items.Add(' - Display Device Attached To Desktop');
If ( Info.StateFlags And DISPLAY_DEVICE_MULTI_DRIVER ) = DISPLAY_DEVICE_MULTI_DRIVER Then
ListBox1.Items.Add(' + Display Device Multi Driver')
Else
ListBox1.Items.Add(' - Display Device Multi Driver');
If ( Info.StateFlags And DISPLAY_DEVICE_PRIMARY_DEVICE ) = DISPLAY_DEVICE_PRIMARY_DEVICE Then
ListBox1.Items.Add(' + Display Device Primary Device')
Else
ListBox1.Items.Add(' - Display Device Primary Device');
If ( Info.StateFlags And DISPLAY_DEVICE_MIRRORING_DRIVER ) = DISPLAY_DEVICE_MIRRORING_DRIVER Then
ListBox1.Items.Add(' + Display Device Mirroring Driver')
Else
ListBox1.Items.Add(' - Display Device Mirroring Driver');
If ( Info.StateFlags And DISPLAY_DEVICE_VGA ) = DISPLAY_DEVICE_VGA Then
ListBox1.Items.Add(' + Display Device VGA')
Else
ListBox1.Items.Add(' - Display Device VGA');
AdapterName := StrAlloc(SizeOf(Info.DeviceName));
StrCopy(AdapterName, Info.DeviceName);
EnumDisplayDevices(AdapterName, 0, Info, 0);
ListBox1.Items.Insert(OldPos, ' Monitorname : ' + Info.DeviceString);
StrDispose(AdapterName);
Inc(Cntr);
End;
End;
Beispiel :
procedure TForm1.Button1Click(Sender: TObject);
begin
FillMonitorList
end;
Keine Kommentare:
Kommentar veröffentlichen