Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Set Taskbar Autohide
#1
Hi,

The following vba code sets the taskbar to autohide or not. How would I convert this to Quick Macros?
Code:
Copy      Help
Public Declare Function SHAppBarMessage Lib "shell32" (ByVal dwMessage As Long, pData As APPBARDATA) As Long

Public Const ABM_GETSTATE = &H4
Public Const ABM_SETSTATE = &HA
Public Const ABS_AUTOHIDE = &H1
Public Const ABS_ALWAYSONTOP = &H2

Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Public Type APPBARDATA
cbSize As Long
hwnd As Long
uCallbackMessage As Long
uEdge As Long
rc As RECT
lParam As Long
End Type

Sub SetTaskbarAutohide(state As Boolean)
    Dim ABD As APPBARDATA
    ABD.cbSize = Len(ABD)
    SHAppBarMessage ABM_GETSTATE, ABD
    If state Then
        ABD.lParam = ABS_AUTOHIDE
    Else
        ABD.lParam = ABS_ALWAYSONTOP
    End If
    SHAppBarMessage ABM_SETSTATE, ABD
End Sub

Thanks!

Tony
#2
Function SetTaskbarAutohide
Code:
Copy      Help
;/
function state

;EXAMPLE
;SetTaskbarAutohide 1


APPBARDATA ABD.cbSize = sizeof(ABD)
SHAppBarMessage ABM_GETSTATE, &ABD
if state
,ABD.lParam = ABS_AUTOHIDE
else
,ABD.lParam = ABS_ALWAYSONTOP
SHAppBarMessage ABM_SETSTATE, &ABD
#3
That works great! Thank you so much!! :-)

My goal is to have the taskbar autohide when InDesign is active, and have the taskbar show the rest of the time.

So far I've gotten about 90% of the way to make this happen consistently with triggers on window class indesign for Active, Inactive, and Destroyed.

I'm not sure how to get it 100%, tho. About 10% of the time it misses the Indesign Inactive trigger and the taskbar stays autohidden. Perhaps a trigger that runs any time any window is activated and test if the window class is InDesign, but not sure how to trigger that.

Thanks again for your help!!

Tony
#4
Function InDesign_HideTaskbar
Trigger !a"InDesign"     Help - how to add the trigger to the macro
Code:
Copy      Help
int hwnd=val(_command)

SetTaskbarAutohide 1

rep
,0.5
,if win!=hwnd
,,SetTaskbarAutohide 0
,,break
#5
phenomenal!!!
S


Forum Jump:


Users browsing this thread: 1 Guest(s)