When we need to obtain the resolution of the computer when the program is running, there are two methods: ① You can give the resolution of the screen in pixels by accessing the SCREEN global variables provided by Delphi, namely SCREEN.WIDTH and SCREEN.HEIGHT. ② Use the Windows API function GetDeviceCaps() to obtain the resolution of the monitor used. The source code is as follows:
Application.Initialize;
Application.CreateForm(TForm1, Form1);
CASE GetDeviceCaps(GetDC(Form1.Handle), HORZRES) of
640: //Code for processing resolution of 640×480;
800: //Code processing 800×600 resolution;
1024: //Code for processing 1024×768 resolution;
1280: //Code processing resolution of 1280×1024;
END;