How to Determine the Screen Resolution
December 15th, 1999
No comments
There are two ways to determine the screen’s height and width.
1) Use the global Screen variable.
uses
Forms;
...
Screen.Height { Screen height in pixels }
Screen.Width { Screen width in pixels }
...
2) Use the Windows API GetSystemMetrics() function. This function can be useful in applications that don’t use the VCL like console applications.
uses
Windows;
...
GetSystemMetric(SM_CXSCREEN) { Screen height in pixels }
GetSystemMetric(SM_CYSCREEN) { Screen width in pixels }
...
Categories: Graphics api, check, code, Delphi, determine, getsystemmetrics function, height, object pascal, pixels, resolution, screen, size, sm, source, source code, tip, trick, vcl, width, windows, windows api