[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'Forms' (#lcl)

TScreen.MonitorFromWindow

Finds the monitor containing the form with the given window handle.

Declaration

Source position: forms.pp line 1263

public function TScreen.MonitorFromWindow(

  const Handle: THandle;

  MonitorDefault: TMonitorDefaultTo = mdNearest

):TMonitor;

Arguments

Handle

  

The window handle to use.

MonitorDefault

  

What to return when no monitor was found.

Function result

The monitor found.

Description

MonitorFromWindow is a TMonitor function used to locate monitor where the form represented by the specified window Handle is displayed.

MonitorDefault is a TMonitorDefaultTo enumeration value which indicates the monitor used when the display area for the form is not found on a monitor. See TMonitorDefaultTo for more information about the values in the enumeration and their meanings.

MonitorFromWindow calls MonitorFromWindow in the widgetset class to get a monitor handle used to locate the monitor in the Monitors property. The UpdatedMonitor method is called to ensure that Monitors contains up-to-date values for the available monitors.

If a monitor with the Handle is not found, GetWindowRect is called to get the display areas for the monitor Handle. MonitorFromRect is called to locate the monitor which contains the rectangle.


Version 3.2 Generated 2024-02-25 Home