Jump to content

Progress just above taskbar


Xander
 Share

Recommended Posts

I'm revising one of my scripts to use a progress bar, which I want positioned just above the taskbar. Only problem is that some taskbars hide ... and when they pop back up, they are showing over the progress bar. Sure, I could make a guess at an average height of a taskbar (1-2 lines) and just compensate for that, but I'd like to see if it can be done.

i.e.: $Y = @DesktopHeight - $taskbarheight - $ProgressBarHeight

Edited by Xander
Link to comment
Share on other sites

$a_taskbar = _GetTaskBarPos()
If IsArray($a_taskbar) Then
    ConsoleWrite("Left  : " & $a_taskbar[1] & @LF)
    ConsoleWrite("Top   : " & $a_taskbar[2] & @LF)
    ConsoleWrite("Right : " & $a_taskbar[3] & @LF)
    ConsoleWrite("Bottom: " & $a_taskbar[4] & @LF)
EndIf

Func _GetTaskBarPos()
    Global Const $ABM_GETTASKBARPOS = 0x5
    $h_taskbar = WinGetHandle("","Start")
    $AppBarData = DllStructCreate("dword;int;uint;uint;int;int;int;int;int")
;~ DWORD cbSize;
;~   HWND hWnd;
;~   UINT uCallbackMessage;
;~   UINT uEdge;
;~   RECT rc;
;~   LPARAM lParam;
    DllStructSetData($AppBarData,1,DllStructGetSize($AppBarData))
    DllStructSetData($AppBarData,2,$h_taskbar)
    $lResult = DllCall("shell32.dll","int","SHAppBarMessage","int",$ABM_GETTASKBARPOS,"ptr",DllStructGetPtr($AppBarData))
    If Not @error Then
        If $lResult[0] Then
            Return StringSplit(DllStructGetData($AppBarData,5) & "|" & _
                DllStructGetData($AppBarData,6) & "|"   & DllStructGetData($AppBarData,7) & "|" & _
                DllStructGetData($AppBarData,8),"|")
        EndIf
    EndIf
    SetError(1)
    Return 0
EndFunc

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

I'm revising one of my scripts to use a progress bar, which I want positioned just above the taskbar.

Are you sure you want to assume the user has the taskbar at the bottom of the screen? It could be a the top or left or right; or the person might not even use the explorer shell.
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

Think that would depend on the x,y,width,height

Might be a function that says location of bar, not sure on that

Global Const $ABS_ALWAYSONTOP = 0x2
Global Const $ABS_AUTOHIDE = 0x1
$result = _GetTaskBarState()
If BitAND($result,$ABS_ALWAYSONTOP) = $ABS_ALWAYSONTOP Then ConsoleWrite("ALWAYSONTOP" & @LF)
If BitAND($result,$ABS_AUTOHIDE) = $ABS_AUTOHIDE Then ConsoleWrite("AUTOHIDE" & @LF)

Func _GetTaskBarState()
    Global Const $ABM_GETSTATE = 0x4
    $h_taskbar = WinGetHandle("","Start")
    $AppBarData = DllStructCreate("dword;int;uint;uint;int;int;int;int;int")
;~ DWORD cbSize;
;~   HWND hWnd;
;~   UINT uCallbackMessage;
;~   UINT uEdge;
;~   RECT rc;
;~   LPARAM lParam;
    DllStructSetData($AppBarData,1,DllStructGetSize($AppBarData))
    DllStructSetData($AppBarData,2,$h_taskbar)
    $lResult = DllCall("shell32.dll","int","SHAppBarMessage","int",$ABM_GETSTATE,"ptr",DllStructGetPtr($AppBarData))
    If Not @error Then
        If $lResult[0] Then Return $lResult[0]
    EndIf
    SetError(1)
    Return 0
EndFunc
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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