Apologizing for bumping an old post, I just want to provide a cleaner snippet, which is more intuitive based on MSDOC's APPBARDATA: https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-appbardata
ToggleTaskbarAutoHide()
MsgBox(262144, '', 'Taskbar autohide toggled')
ToggleTaskbarAutoHide()
Func ToggleTaskbarAutoHide()
Local Const $ABM_GETSTATE = 0x00000004
Local Const $ABM_SETSTATE = 0x0000000A
Local Const $ABS_AUTOHIDE = 0x00000001
Local Const $ABS_ALWAYSONTOP = 0x00000002
Local $tAPPBARDATA = DllStructCreate('dword;int;uint;uint;int[4];int')
DllStructSetData($tAPPBARDATA, 1, DllStructGetSize($tAPPBARDATA))
DllStructSetData($tAPPBARDATA, 2, WinGetHandle('[CLASS:Shell_TrayWnd]'))
Local $iCurrentState = DllCall('shell32.dll', 'int', 'SHAppBarMessage', 'dword', $ABM_GETSTATE, 'ptr', DllStructGetPtr($tAPPBARDATA))
Local $iNewState = $iCurrentState[0] ? $ABS_ALWAYSONTOP : $ABS_AUTOHIDE
DllStructSetData($tAPPBARDATA, 6, $iNewState)
DllCall('shell32.dll', 'int', 'SHAppBarMessage', 'dword', $ABM_SETSTATE, 'ptr', DllStructGetPtr($tAPPBARDATA))
EndFunc