Jump to content
Sign in to follow this  
Kip

DesktopHeight without taskbar?

Recommended Posts

Kip

Hi

How do I get the desktopheight witout the taskbar:

Posted Image

so: i want to get the red arrow, not the blue one.

(and the taskbar has with every style a different height, so)

Kip :)

Share this post


Link to post
Share on other sites
DjDeep00

Here you go....

Opt("WinTitleMatchMode", 4)
$get=ControlGetPos("classname=Shell_TrayWnd", "", "ReBarWindow321")

$Height_Minus_Taskbar=@DesktopHeight-$get[3]

Share this post


Link to post
Share on other sites
SmOke_N

What if the taskbar is on one of the sides?

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
SmOke_N

I was thinking about this thread as I was walking out the door, try this and see if you get the results you want (haven't tested it yet):

#include <Array.au3>
$aDTWH = _DeskTopVisibleArea()
_ArrayDisplay($aDTWH)
Func _DeskTopVisibleArea()
    Local $aInfo[2]
    Local $aCPos = ControlGetPos('[CLASS:Shell_TrayWnd]', '', '')
    If IsArray($aCPos) = 0 Then
        $aInfo[0] = @DesktopWidth
        $aInfo[1] = @DesktopHeight
    ElseIf $aCPos[2] = @DesktopWidth Then
        $aInfo[0] = @DesktopWidth
        $aInfo[1] = @DesktopHeight - ($aCPos[3] - $aCPos[1])
    Else
        $aInfo[0] = @DesktopWidth - ($aCPos[2] - $aCPos[0])
        $aInfo[1] = @DesktopHeight
    EndIf
    Return $aInfo
EndFunc


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
Siao

See this link

#400358

function to get desktop work area rectangle. Then it's a matter of subtracting top from bottom.

Edited by Siao

"be smart, drink your wine"

Share this post


Link to post
Share on other sites
DjDeep00

What if the taskbar is on one of the sides?

Good point Smoke_N! From the picture, I figured it would be always on the bottom but the best way would be two figure out where it would and then do the calculation.

Share this post


Link to post
Share on other sites
SmOke_N

Smoke_N's script doesnt work. is that true or is is just me? (or vista:)

What do you mean by "doesn't" work?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
SmOke_N

what i say: Doesnt work

Why don't you explain what in the world you mean by "doesn't" work... Amazing you actually want help, and you can't even provide any type of details other than "doesn't work" pfft :) ...

ie...

Doesn't give any results at all.

Doesn't give the right results.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
Kip

ok, it always returned -4 as width

but my own version works (not so different)

$aCPos = ControlGetPos("[CLASS:Shell_TrayWnd]","","")
    
$Width = @DesktopWidth
$Height = @DesktopHeight

If $aCPos[3] > $aCPos[2] Then
    $Width = @DesktopWidth-$aCPos[2]
Else
    $Height = @DesktopHeight-$aCPos[3]
EndIf

MsgBox(0,"dd", $Width&","&$Height)

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.