rimmi2002

How to find out total number of monitors

4 posts in this topic

#1 ·  Posted

Hi I am writing a script and I'd like it to behave differently based on the # on monitors attached. Is there a way to find this out by an Autoit command? Thanks.

Share this post


Link to post
Share on other sites



#2 ·  Posted

Look at the _WinAPI_EnumDisplayMonitors() function, the top line returned gives you the count of monitors.

Share this post


Link to post
Share on other sites

#3 ·  Posted

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)

 

Share this post


Link to post
Share on other sites

#4 ·  Posted

Thanks for the help. 

Share this post


Link to post
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