Checks if the specified monitor exists and optionally retrieves its bounding coordinates.
ActualN := MonitorGet(N, &Left, &Top, &Right, &Bottom)
Type: Integer
If omitted, the primary monitor will be used. Otherwise, specify the monitor number, between 1 and the number returned by MonitorGetCount.
Type: VarRef
If omitted, the corresponding value will not be stored. Otherwise, specify references to the output variables in which to store the bounding coordinates, in pixels.
Type: Integer
This function returns the monitor number (the same as N unless N was omitted).
On failure, an exception is thrown and the output variables are not modified.
The built-in variables A_ScreenWidth and A_ScreenHeight contain the dimensions of the primary monitor, in pixels.
SysGet can be used to retrieve the bounding rectangle of all display monitors. For example, this retrieves the width and height of the virtual screen:
MsgBox SysGet(78) " x " SysGet(79)
MonitorGetWorkArea, SysGet, Monitor functions
Shows the bounding coordinates of the second monitor in a message box.
try { MonitorGet 2, &Left, &Top, &Right, &Bottom MsgBox "Left: " Left " -- Top: " Top " -- Right: " Right " -- Bottom: " Bottom } catch MsgBox "Monitor 2 doesn't exist or an error occurred."
See example #1 on the Monitor Functions page for another demonstration of this function.