ok, here is it:
procedure TForm1.Button2Click(Sender: TObject);
type
TDeviceMode2 = packed record
dmDeviceName: array[0..CCHDEVICENAME - 1] of AnsiChar;
dmSpecVersion: Word;
dmDriverVersion: Word;
dmSize: Word;
dmDriverExtra: Word;
dmFields: DWORD;
dmPosition: TPoint;
dmDisplayOrientation: DWORD;
dmDisplayFixedOutput: DWORD;
dmColor: SHORT;
dmDuplex: SHORT;
dmYResolution: SHORT;
dmTTOption: SHORT;
dmCollate: SHORT;
dmFormName: array[0..CCHFORMNAME - 1] of AnsiChar;
dmLogPixels: Word;
dmBitsPerPel: DWORD;
dmPelsWidth: DWORD;
dmPelsHeight: DWORD;
dmDisplayFlags: DWORD;
dmDisplayFrequency: DWORD;
dmICMMethod: DWORD;
dmICMIntent: DWORD;
dmMediaType: DWORD;
dmDitherType: DWORD;
dmICCManufacturer: DWORD;
dmICCModel: DWORD;
dmPanningWidth: DWORD;
dmPanningHeight: DWORD;
end;
const
EDD_GET_DEVICE_INTERFACE_NAME = 1;
DISPLAY_DEVICE_ACTIVE = 1;
ENUM_CURRENT_SETTINGS: DWORD = DWORD(-1);
var
d: TDisplayDevice;
i: Integer;
DevMode: TDevMode;
begin
for i:= 0 to Screen.MonitorCount do
begin
d.cb:= sizeof(d);
if EnumDisplayDevices( nil, i, d, EDD_GET_DEVICE_INTERFACE_NAME) then
begin
Memo1.Lines.Add( 'Monitor ' + IntToStr(i) );
if (d.StateFlags and DISPLAY_DEVICE_ACTIVE) =0 then
Memo1.Lines.Add( 'Monitor isn''t active' );
Memo1.Lines.Add( d.DeviceName );
Memo1.Lines.Add( d.DeviceString );
if EnumDisplaySettings( d.DeviceName, ENUM_CURRENT_SETTINGS, DevMode ) then
begin
Memo1.Lines.Add( Format( 'Resolution %d x %d', [DevMode.dmPelsWidth, DevMode.dmPelsHeight]) );
Memo1.Lines.Add( Format( 'Bits per pixels %d', [DevMode.dmBitsPerPel]) );
Memo1.Lines.Add( Format( 'Rect %d, %d, %d, %d', [TDeviceMode2(DevMode).dmPosition.X, TDeviceMode2(DevMode).dmPosition.Y, TDeviceMode2(DevMode).dmPosition.X+DevMode.dmPelsWidth, TDeviceMode2(DevMode).dmPosition.Y+DevMode.dmPelsHeight ]) );
end;
Memo1.Lines.Add('');
end;
end;
end;