Sign in to follow this  
Followers 0
Mechaflash

Logical ordering of displays

2 posts in this topic

#1 ·  Posted (edited)

I have multiple outputs which I want to perform a check against. I've used the _WinAPI_EnumDisplayDevices() function with the _MonitorAndDesktopInfo() function from Display_Library_Functions.au3, which is a 3rd party library. I have it output x-resolution values into an array $_xRes[ ]. If I had 5 monitors horizontally stacked, at 1280X1024 resolution each, my outputs would be -2560, -1280, 0, 1280, 2560.

The following is my code to accomplish this:

Dim $x = 0, $y = 0, $_enum, $_xRes[99], $_xResPre, $LeftMon, $MiddleMon, $RightMon
Do
    $_enum = _WinAPI_EnumDisplayDevices("", $x)
    If $_enum[3] = 1 OR $_enum[3] = 2 OR $_enum[3] = 3 OR $_enum[3] = 33 OR $_enum[3] = 35 Then
        $x+=1
        $y+=1
        $_xResPre = _MonitorAndDesktopInfo()
        $_xRes[$y] = $_xResPre[$x][1]
    Else
        $x+=1
    EndIf
Until NOT $_enum[3]

Now I want to create a conditional statement to order these outputs from the lowest negative to the highest positive. The whole idea behind it is to get a logical ordering of the monitors based on their physical location, because if the monitors on the machine aren't installed in the correct order on the adapters, the output can come out jumbled like 0, 1280, -2560, 2560, -1280 ... or any other order.

However... I'm stumped on what method I would use to do this... I'm trying to think of a way that it would work even if there were hundreds of monitors (hypothetically speaking of course =D ) to enumerate and calculate their positions (EDIT) on a horizontal plane.

If I can find out what method to use for this, I could also adapt it to work for enumerating vertically stacked monitors and perform a check on the physical locations of vertically and horizontally stacked monitors as well.

Edited by mechaflash213

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

AIYA! I was scrolling through the helpfile, and came across _ArraySort() which will work for what I need. I can even leave the [0] value as the "Default Display" so you can call that display when needed =D. I can even use _ArraySort() for the 2D sorting for the vertical and horizontal implementation, and turn my 1D array into a 2D array, fetching the y-resolution values as well.

EDIT: Note, I have to ReDim $_xRes[$y + 1] so it reports back the values in the correct array assignments, and starting at index 1, leaving 0 open for my default monitor

Edited by mechaflash213

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

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
Sign in to follow this  
Followers 0