Quick way to retrieve current screen resolution
Why use the Windows API when you can retrieve the current screen resolution using two simple variables?
Screen.Width
Screen.Height
Listing #1 : Delphi code. Download
scrsize (0.16 KB).
Above variables will automatically get updated if the screen resolution were to change while the application is running.
MessageDlg(
'screen width = ' + IntToStr( Screen.Width ) +
', screen height = ' + IntToStr( Screen.Height ),
mtInformation, [mbOk], 0 );
Listing #2 : Delphi code. Download
sample (0.23 KB).
Applicable Keywords : Delphi, Delphi 1.x, Delphi 2.x, Delphi 3.x