Jump to content

Resolution of the working area of the desktop


Qwerty212
 Share

Recommended Posts

Hello from a non english autoit learner.

I'm trying to make a gui with a webcam using some of the examples that there are on the forum, but there's no way to make the size of this gui as big as the avaible area of the desktop without overlaping the toolbar (please, see image attached:)

Posted Image

I know that depending on the computer that the program will run everyone will have a different toolbar size, so I'don't know how to manage to know how many pixels I've to take from the @Desktopheight to tell it later to the webcam.

Can you please help me on that?

Thanks in advance

Link to comment
Share on other sites

  • Moderators

adolfito121,

Take a look at this topic where I show how to get the size of the taskbar - it should help you work out the screen size you need. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

That's it! ;)

Now if I run your code like that:

If $aTaskBar_Pos[1] > 0 Then
        ; Taskbar at BOTTOM
        If $aTaskBar_Pos[1] > @DesktopHeight - $aTaskBar_Pos[3] Then
            Return "Bottom Hidden"
        Else
            Return $aTaskBar_Pos[3]
        EndIf

In the bottom of scite I've get a "66" (and If I change my taskbar to a normal size then I get a 34, so I guess that 66 are the pixel that taskbar sizes...)

... but how can I pass this 66 to another part of the gui??

(something like:

$gui4 = GUICreate("", @DesktopWidth, @DesktopHeight - $aTaskBar_Pos, 0, 0)
stills giving me a fullscreen gui :) Edited by adolfito121
Link to comment
Share on other sites

  • Moderators

adolfito121,

The function returns an array - the clues are the $a... prefix and the fact that you need to use the element address format $aTaskBar_Pos[3] when you return a value. ;)

So try using: ;)

$gui4 = GUICreate("", @DesktopWidth, @DesktopHeight - $aTaskBar_Pos[3], 0, 0)

If you are not sure about using arrays, could I recommend the Wiki Arrays tutorial? :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

adolfito121,

Glad I could help. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

 Here is a little script with 3 functions to demonstrate how to get information about the working area of the desktop. That is the area of the desktop not covered by the taskbar or any docked windows.  It will give the correct result no matter which edge of the screen the taskbar is docked.

#Include <WinAPI.au3>
Local $Rect[4]
$Rect = _GetworkingAreaRect()

MsgBox(0,"Desktop Working Area", "Width = " & _GetworkingAreaWidth() & @CRLF & "Height = " & _GetworkingAreaHeight() & @CRLF & "TopLeft = " & $Rect[0] & "," & $Rect[1] & @CRLF & "BottomRight = " & $Rect[2] & "," & $Rect[3] )


Func _GetworkingAreaWidth()
    Local $aRect[4]
    Local $iWidth = 0

    $aRect = _GetworkingAreaRect()
    If Not @error Then
        $iWidth = $aRect[2] - $aRect[0]
        Return $iWidth
    Else
        Return SetError(1,0,0)
    EndIf

EndFunc
Func _GetworkingAreaHeight()
    Local $aRect[4]
    Local $iWidth = 0

    $aRect = _GetworkingAreaRect()
    If Not @error Then
        $iWidth = $aRect[3] - $aRect[1]
        Return $iWidth
    Else
        Return SetError(1,0,0)
    EndIf

EndFunc

Func _GetworkingAreaRect()
    Local $aRect[4]
    Const $SPI_GETWORKAREA = 0x0030
    Local $rect = DllStructCreate("int;int;int;int")
    Local $iResult = 0

    $iResult = _WinAPI_SystemParametersInfo($SPI_GETWORKAREA, 0 , DllStructGetPtr($rect))
    If $iResult Then
        $aRect[0] = DllStructGetData($rect,1)
        $aRect[1] = DllStructGetData($rect,2)
        $aRect[2] = DllStructGetData($rect,3)
        $aRect[3] = DllStructGetData($rect,4)
        Return $aRect
    Else
        Return SetError(1,0,0)
    EndIf

EndFunc
Edited by Bowmore

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

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