Platforms to show: All Mac Windows Linux Cross-Platform

Back to WindowsMonitorMBS class.

WindowsMonitorMBS.AllMonitors as WindowsMonitorMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Windows MBS Win Plugin 11.3 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
Queries all monitors.
Example
for each m as WindowsMonitorMBS in WindowsMonitorMBS.AllMonitors
MsgBox m.DeviceName+": "+str(m.Left)+"x"+str(m.top)+" "+str(m.Width)+"x"+str(m.Height)
next

Returns an array with an entry for each monitor connected to this computer.

See also:

Some examples using this method:

WindowsMonitorMBS.AllMonitors(monitors() as WindowsMonitorMBS) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Windows MBS Win Plugin 11.3 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
Queries all monitors.

Returns the number of monitors found and sets the monitor objects in the array.
if the array is too short, you get the first ubound(monitors)+1 fonts set there.

See also:

WindowsMonitorMBS.MonitorFromPoint(x as Integer, y as Integer, flags as Integer = 0) as WindowsMonitorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Windows MBS Win Plugin 11.3 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
The MonitorFromPoint function retrieves a handle to the display monitor that contains a specified point.
Example
dim m as WindowsMonitorMBS = WindowsMonitorMBS.MonitorFromPoint(1900, 1000)

if m = nil then
MsgBox "Your display is smaller than 1900 x 1000"
else
MsgBox m.DeviceName
end if

x and y: The point of interest in virtual-screen coordinates.
Flags: Determines the function's return value if the point is not contained within any display monitor.

This parameter can be one of the following values.

ValueMeaning
kDefaultToNearestReturns a handle to the display monitor that is nearest to the point.
kDefaultToNullReturns nil.
kDefaultToPrimaryReturns a handle to the primary display monitor.

If the point is contained by a display monitor, the return value is that display monitor.
If the point is not contained by a display monitor, the return value depends on the value of flags.

WindowsMonitorMBS.MonitorFromRect(left as Integer, top as Integer, width as Integer, height as Integer, flags as Integer = 0) as WindowsMonitorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Windows MBS Win Plugin 11.3 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
The MonitorFromRect function retrieves the display monitor that has the largest area of intersection with a specified rectangle.
Example
dim m as WindowsMonitorMBS = WindowsMonitorMBS.MonitorFromRect(0,0,100,100)
MsgBox m.DeviceName

left, top, width, height: The rectangle of interest in virtual-screen coordinates.
Flags: Determines the function's return value if the rectangle does not intersect any display monitor.

This parameter can be one of the following values.

ValueMeaning
kDefaultToNearestReturns a handle to the display monitor that is nearest to the rectangle.
kDefaultToNullReturns nil.
kDefaultToPrimaryReturns a handle to the primary display monitor.

If the rectangle intersects one or more display monitor rectangles, the return value is the display monitor that has the largest area of intersection with the rectangle.
If the rectangle does not intersect a display monitor, the return value depends on the value of Flags.

WindowsMonitorMBS.MonitorFromWindow(win as DesktopWindow, flags as integer = 0) as WindowsMonitorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Windows MBS Win Plugin 22.0 ❌ No ✅ Yes ❌ No ❌ No Desktop only
The MonitorFromWindow function retrieves the display monitor that has the largest area of intersection with the bounding rectangle of a specified window.

win: The window of interest.
Flags: Determines the function's return value if the window does not intersect any display monitor.

This parameter can be one of the following values:

ValueMeaning
kDefaultToNearestReturns the display monitor that is nearest to the window.
kDefaultToNullReturns nil.
kDefaultToPrimaryReturns the primary display monitor.

If the window intersects one or more display monitor rectangles, the return value is the display monitor that has the largest area of intersection with the window.

If the window does not intersect a display monitor, the return value depends on the value of Flags.
If the window is currently minimized, MonitorFromWindow uses the rectangle of the window before it was minimized.

See also:

WindowsMonitorMBS.MonitorFromWindow(win as window, flags as Integer = 0) as WindowsMonitorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Windows MBS Win Plugin 11.3 ❌ No ✅ Yes ❌ No ❌ No Desktop only
The MonitorFromWindow function retrieves the display monitor that has the largest area of intersection with the bounding rectangle of a specified window.
Example
dim m as WindowsMonitorMBS = WindowsMonitorMBS.MonitorFromWindow(window1)
MsgBox m.DeviceName

win: The window of interest.
Flags: Determines the function's return value if the window does not intersect any display monitor.

This parameter can be one of the following values:

ValueMeaning
kDefaultToNearestReturns the display monitor that is nearest to the window.
kDefaultToNullReturns nil.
kDefaultToPrimaryReturns the primary display monitor.

If the window intersects one or more display monitor rectangles, the return value is the display monitor that has the largest area of intersection with the window.

If the window does not intersect a display monitor, the return value depends on the value of Flags.
If the window is currently minimized, MonitorFromWindow uses the rectangle of the window before it was minimized.

See also:

WindowsMonitorMBS.MonitorFromWindow(WindowHandle as Integer, flags as Integer = 0) as WindowsMonitorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Windows MBS Win Plugin 11.3 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
The MonitorFromWindow function retrieves the display monitor that has the largest area of intersection with the bounding rectangle of a specified window.
Example
dim m as WindowsMonitorMBS = WindowsMonitorMBS.MonitorFromWindow(window1.handle)
MsgBox m.DeviceName

WindowHandle: A handle to the window of interest.
Flags: Determines the function's return value if the window does not intersect any display monitor.

This parameter can be one of the following values:

ValueMeaning
kDefaultToNearestReturns the display monitor that is nearest to the window.
kDefaultToNullReturns nil.
kDefaultToPrimaryReturns the primary display monitor.

If the window intersects one or more display monitor rectangles, the return value is the display monitor that has the largest area of intersection with the window.

If the window does not intersect a display monitor, the return value depends on the value of Flags.
If the window is currently minimized, MonitorFromWindow uses the rectangle of the window before it was minimized.

See also:

The items on this page are in the following plugins: MBS Win Plugin.


The biggest plugin in space...