- Getting a general list of terminal and program properties
- Terminal build number
- Program type and license
- Terminal and program operating modes
- Permissions
- Checking network connections
- Computing resources: memory, disk, and CPU
- Screen specifications
- Terminal and program string properties
- Custom properties: Bar limit and interface language
- Binding a program to runtime properties
- Checking keyboard status
- Checking the MQL program status and reason for termination
- Programmatically closing the terminal and setting a return code
- Handling runtime errors
- User-defined errors
- Debug management
- Predefined variables
- Predefined constants of the MQL5 language
Screen specifications
Several properties provided by the function TerminalInfoInteger, refer to the video subsystem of the computer.
Identifier |
Description |
---|---|
TERMINAL_SCREEN_DPI |
Resolution of information output to the screen is measured in the number of dots per linear inch (DPI, Dots Per Inch) |
TERMINAL_SCREEN_LEFT |
Left coordinate of the virtual screen |
TERMINAL_SCREEN_TOP |
Top coordinate of the virtual screen |
TERMINAL_SCREEN_WIDTH |
Virtual screen width |
TERMINAL_SCREEN_HEIGHT |
Virtual screen height |
TERMINAL_LEFT |
Left coordinate of the terminal relative to the virtual screen |
TERMINAL_TOP |
Top coordinate of the terminal relative to the virtual screen |
TERMINAL_RIGHT |
Right coordinate of the terminal relative to the virtual screen |
TERMINAL_BOTTOM |
Bottom coordinate of the terminal relative to the virtual screen |
Knowing the TERMINAL_SCREEN_DPI parameter, you can set the dimensions of graphic objects so that they look the same on monitors with different resolutions. For example, if you want to create a button with a visible size of X centimeters, then you can specify it as the number of screen dots (pixels) using the following function:
int cm2pixels(const double x)
|
The virtual screen is a bounding box of all monitors. If there is more than one monitor in the system and the order of their arrangement differs from strictly left to right, then the left coordinate of the virtual screen may turn out to be negative, and the center (reference point) will be on the border of two monitors (in the upper left corner of the main monitor).
Virtual screen from multiple monitors
If the system has one monitor, then the size of the virtual screen fully corresponds to it.
The terminal coordinates do not take into account its possible current maximization (that is, if the main window is maximized, the properties return the unmaximized size, although the terminal is expanded to the entire monitor).
In the EnvScreen.mq5 script, check reading screen properties.
void OnStart()
|
Here is an example of the resulting log entries.
TerminalInfoInteger(TERMINAL_SCREEN_DPI)=96 / ok
|
In addition to the general sizes of the screen and the terminal window, MQL programs quite often need to analyze the current size of the chart (daughter window inside the terminal). For these purposes, there is a special set of functions (in particular, ChartGetInteger), which we will discuss in the Charts section.