Jump to content

How to find out total number of monitors


Recommended Posts

Also see _WinAPI_GetSystemMetrics()

#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
; From https://www.autoitscript.com/forum/topic/134534-_desktopdimensions-details-about-the-primary-and-secondary-monitors/

Local $a[] = [_WinAPI_GetSystemMetrics($SM_CMONITORS), _ ; Number of monitors.
        _WinAPI_GetSystemMetrics($SM_CXSCREEN), _ ; Width or Primary monitor.
        _WinAPI_GetSystemMetrics($SM_CYSCREEN), _ ; Height or Primary monitor.
        _WinAPI_GetSystemMetrics($SM_CXVIRTUALSCREEN), _ ; Width of the Virtual screen.
        _WinAPI_GetSystemMetrics($SM_CYVIRTUALSCREEN)] ; Height of the Virtual screen.

ConsoleWrite("Number of monitors = " & _WinAPI_GetSystemMetrics($SM_CMONITORS) & @CRLF)
_ArrayDisplay($a)

 

Link to comment
Share on other sites

  • 7 months later...

(a bit late but good information)
_WinAPI_GetSystemMetrics(80) gives you the number of active monitors

 

 

#NoTrayIcon
#include <WinAPI.au3>
$aDevice = _WinAPI_GetSystemMetrics(80)
if $adevice = 1 Then

... (enter your intended action here if one monitor is present)

EndIf

Edited by NaX
clarity
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...