Does FireMonkey have something similar to GetSystemMetrics?

I am rewriting an old application using Delphi 2010, and I would like to place placeholders in my code when I port it to XE2. Just wondering if FireMonkey has the equivalent of GetSystemMetrics. I am particularly interested in:

  • GetSystemMetrics (SM_CXSCREEN)
  • GetSystemMetrics (SM_CYSCREEN)
+4
source share
2 answers

If you need only the main monitor size, and not the desktop size (the sum of n monitors), you can use this:

uses ..., FMX.Platform; var p: TPointF; begin p := Platform.GetScreenSize; ShowMessage(Format('X: %f' + LineFeed + 'Y: %f', [pX, pY])); 

WindowsOS X

+5
source

In fact, SM_CXSCREEN and SM_CYSCREEN should probably not be used at all. It just indicates the dimensions of the main monitor. These days, multiple monitors are not very useful. In VCL code, you should use Screen.Monitors[] and its related properties to get information about your monitors.

As for FMX, there is no support for multiple monitors and there is no platform-independent way to find out screen size indicators. In your shoes, I would just use Screen.Monitors[] and deal with the FMX port when you get to it. In any case, you will have to rewrite your entire GUI code when you send FMX, and this problem is the least of your problems.

Finally when you say

I want to put placeholders in my code when I port it to XE2

I hope you know that porting to FMX is optional. VCL is still supported and available in XE2, and I do not see it uninstalling for a long time. You can connect to XE2 without having anything to do with FMX.

+1
source

Source: https://habr.com/ru/post/1412152/


All Articles