Jump to content

Get Width + Height of multiple monitors


 Share

Recommended Posts

My second monitor has been dead for a few weeks, and a friend of mine is urging me to make my program work with his second monitor. I plan to add a hotkey for a single monitor and separate hotkey for each monitor individually, as well as the entire desktop - but I figured that out.

I have done some searching but could only find how to get the entire screenspace of a desktop. And I do not understand DLL's so I am unsure if that users32.dll would have what I am looking for to get each monitor's information.

It would be great to have this in a 2d-array formatted like so:

$Monitors[0][0] = 3 ;Number of monitors

$Monitors[1][0] = 1024 ;First monitor's width
$Monitors[1][1] = 1280 ;First monitor's height
$Monitors[1][2] = 0 ;First monitor's X-origin
$Monitors[1][3] = 0 ;First monitor's Y-origin

$Monitors[2][0] = 1400 ;Second monitor's width
$Monitors[2][1] = 1050 ;Second monitor's height
$Monitors[2][2] = -1400 ;Second monitor's X-origin
$Monitors[2][3] = 0 ;Second monitor's Y-origin

$Monitors[3][0] = 800 ;Third monitor's width
$Monitors[3][1] = 600 ;Third monitor's height
$Monitors[3][2] = 1024 ;First monitor's X-origin
$Monitors[3][3] = 0 ;First monitor's Y-origin

This example would be 3 monitors side by side, with the first one in the middle and second on the left. All of them would be aligned to the top of the first monitor. If this were lined up physically, you would have the right monitor stacked on a few books and the middle monitor sitting on a magazine, provided the base is the same height.

If there is already a way to get these values, please let me know. Can't find anything in the helpfile, and I do not have another monitor available so this i'll have to hope the code is right and have him test it for me.

Edited by Rad
Link to comment
Share on other sites

Yeah, that is the same code that I linked before, except it's the total resolution of multiple monitors. The dll call's return arrays, they might include separate monitor information... Just a guess, but I can't test it with just one monitor.

I will try to figure this out some time when he has free time, but would love to make some progress before hand.

Link to comment
Share on other sites

Maybe this helps, too:

#include <Array.au3>
Global $hScreen = WinGetHandle("Program Manager")
Global $aScreen_Res = WinGetPos($hScreen)
#cs
 $array[0] = X position
 $array[1] = Y position
 $array[2] = Width
 $array[3] = Height
#ce
_ArrayDisplay($aScreen_Res)
Exit

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

  • 2 weeks later...

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...