Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detecting screen resolution #116

Open
Qazy147 opened this issue Jun 28, 2021 · 10 comments
Open

Detecting screen resolution #116

Qazy147 opened this issue Jun 28, 2021 · 10 comments
Labels
checks Check improvement or new check. enhancement New feature or request PRO To be included in Enterprise Edition

Comments

@Qazy147
Copy link
Contributor

Qazy147 commented Jun 28, 2021

Maybe this function will be useful:

GetMaxResolution.au3.txt

@micwoj92 micwoj92 added the enhancement New feature or request label Jun 28, 2021
@ghost
Copy link

ghost commented Jun 28, 2021

This check can get quite complicated with different numbers of displays and aspect ratios.
I'm thinking it's pretty much the same as the CPU Frequency requirement in that nobody actually fails it.
So doing the work and dealing with the support tickets probably isn't worth it.
The requirement:
High definition (720p) display that is greater than 9” diagonally, 8 bits per colour channel

@Qazy147
Copy link
Contributor Author

Qazy147 commented Jun 28, 2021

I can easily modify function to return number of all monitor, number of monitors, which can be set to 1280x720 or higher and how much monitors can't. Physical dimensions can be probably obtained too.

@Qazy147
Copy link
Contributor Author

Qazy147 commented Jun 29, 2021

Here is function to detect display size in inches:

Func _GetDisplaySize()
; $out[0][0] = number of displays
; $out[x][1] = size of display X
    Local $out[1][2]=[[0,"Size"]]
    Local $Obj_WMIService = ObjGet('winmgmts:\\' & @ComputerName & '\root\wmi')
    If @error or (Not IsObj($Obj_WMIService)) Then Return SetError(1, 0, $out)
    Local $Col_Items = $Obj_WMIService.ExecQuery('Select MaxHorizontalImageSize,MaxVerticalImageSize from WmiMonitorBasicDisplayParams')
    If @error or (Not IsObj($Obj_WMIService)) Then Return SetError(2, 0, $out)
    For $i in $Col_Items
        $out[0][0] += 1
        ReDim $out[$out[0][0]+1][2]
        $out[$out[0][0]][0] = $out[0][0]
        If ($i.MaxHorizontalImageSize = 0) or ($i.MaxVerticalImageSize = 0) Then
            $out[$out[0][0]][1] = "Unknown"
        Else
            $out[$out[0][0]][1] = Round(Sqrt($i.MaxHorizontalImageSize^2 + $i.MaxVerticalImageSize^2) / 2.54)
        EndIf
    Next
    Return $out
EndFunc

It returns array, but can by modified. E.g. to return single number as size of given display.

Func _GetDisplaySize($DisplayNumber)
    Local $out[1][2]=[[0,"Size"]]
    Local $Obj_WMIService = ObjGet('winmgmts:\\' & @ComputerName & '\root\wmi')
    If @error or (Not IsObj($Obj_WMIService)) Then Return SetError(1, 0, "Detection Error")
    Local $Col_Items = $Obj_WMIService.ExecQuery('Select MaxHorizontalImageSize,MaxVerticalImageSize from WmiMonitorBasicDisplayParams')
    If @error or (Not IsObj($Obj_WMIService)) Then Return SetError(2, 0, "Detection Error")
    For $i in $Col_Items
        $out[0][0] += 1
        ReDim $out[$out[0][0]+1][2]
        $out[$out[0][0]][0] = $out[0][0]
        If ($i.MaxHorizontalImageSize = 0) or ($i.MaxVerticalImageSize = 0) Then
            $out[$out[0][0]][1] = "Unknown"
        Else
            $out[$out[0][0]][1] = Round(Sqrt($i.MaxHorizontalImageSize^2 + $i.MaxVerticalImageSize^2) / 2.54)
        EndIf
    Next
    If ($DisplayNumber > 0) and ($DisplayNumber <= $out[0][0]) Then Return $out[$DisplayNumber][1]
    Return "Display " & $DisplayNumber & " undetected"
EndFunc

@Qazy147
Copy link
Contributor Author

Qazy147 commented Jul 2, 2021

I have a question. I would like to write function to test resolution and dimensions for connected displays. Should it test current resolution or maximal / native resolution?
It would look like this

Func _GetDisplayInfo($minWidht = 1366, $minHeight = 768, $minInches = 9)

As result would be array:
[0] = total number of monitors
[1] = number of bigger or same size monitors
[2] = number of smaller monitors
[3] = number of monitor with undetected parameters

Would it be helpful or it's not worth it?

@Qazy147
Copy link
Contributor Author

Qazy147 commented Jul 4, 2021

I completed display properties detection function, but it needs some testing (I have only one monitor right now). What should be input and how should output look like?
GetMaxResolution.au3.txt

@rcmaehl
Copy link
Owner

rcmaehl commented Jul 4, 2021

I'll take a look in the morning

@rcmaehl rcmaehl added the checks Check improvement or new check. label Jul 6, 2021
@Qazy147
Copy link
Contributor Author

Qazy147 commented Jul 13, 2021

Improved version with capability to save results into file.
GetMaxResolution.au3.txt

@rcmaehl
Copy link
Owner

rcmaehl commented Jul 25, 2021

@Qazy147 I'll look into getting this added into the advanced checks section I'm adding.

Is
[0] = total number of monitors
[1] = number of bigger or same size monitors
[2] = number of smaller monitors
[3] = number of monitor with undetected parameters

Still the return array?

Can you modify it to

[0] = total number of monitors
[1] = number of compliant monitors
[2] = number of lower resolution monitors
[3] = number of physically smaller monitors
[4] = number of monitors with less than 8 bits per color
[4] = number of monitor with undetected parameters

@Qazy147
Copy link
Contributor Author

Qazy147 commented Jul 25, 2021

Yes, I can modify it, but there is one catch. What exactly mean "8 bits per color channel". For example my notebook can be set to 1920 x 1080 x 32 bits, but according EDID LCD panel has only 6 bits per color. So based on resolution which I can set it's compliant (assuming there is always 3 color channels), but according EDID it's not compliant.

@Qazy147
Copy link
Contributor Author

Qazy147 commented Jul 25, 2021

First version
_MonitorInfo.au3.txt

@rcmaehl rcmaehl added the PRO To be included in Enterprise Edition label Nov 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
checks Check improvement or new check. enhancement New feature or request PRO To be included in Enterprise Edition
Projects
None yet
Development

No branches or pull requests

3 participants