Jump to content

Idea - Check Screen Resolution and Window Size at Beginning of Script


etidd
 Share

Go to solution Solved by ioa747,

Recommended Posts

So, I had a new idea to create a UDF that checks the current screen resolution and window sizes to ensure that the script will properly execute as tested. Maybe I would put it in a separate .au3 file and include it with most scripts. This is similar to what I am doing by checking if certain processes are running and closing them before executing a script as if a program is currently running, it may cause a problem in execution.

Perhaps this has already been done before as it seems like it may be a sound practice. If a window size is different than when it was tested, it may cause the script to malfunction.

Does anyone do things like this or calculate coordinates by function? Or is this overblown and just better to target everything with precise coordinates?

Link to comment
Share on other sites

Hi.

Taken from some other posting in this forum, just a snippet to give you a start:

Func DesktopWorkingAreaHeight()
    Local $dRECT = DllStructCreate("long; long; long; long")
    Local $spiRet = DllCall("User32.dll", "int", "SystemParametersInfo", _
            "uint", 48, "uint", 0, "ptr", DllStructGetPtr($dRECT), "uint", 0)
    If @error Then Return 0
    If $spiRet[0] = 0 Then Return 0
    Local $aRet[4] = [DllStructGetData($dRECT, 1), DllStructGetData($dRECT, 2), DllStructGetData($dRECT, 3), DllStructGetData($dRECT, 4)]
    Local $MaxHeight = $aRet[3] - $aRet[1]
    ; substract height of task bar

    $TitleBarHeight = _WinAPI_GetSystemMetrics($SM_CYCAPTION)
    Return $MaxHeight - $TitleBarHeight - 10
EndFunc   ;==>DesktopWorkingAreaHeight

 

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

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