I checked the taskbar with Microsoft Spy++, while changing the setting manually, it was receiving the message WM_SETTINGCHANGE.
Code: Select all
q:: ;taskbar - toggle always/never combine (tested on Windows 7)
;do it manually: right-click taskbar, Properties, Taskbar tab, Taskbar buttons:
;vState := 0 ;Always combine, hide labels
;vState := 1 ;Combine when taskbar is full
;vState := 2 ;Never combine
RegRead, vState, HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, TaskbarGlomLevel
vState := !vState * 2
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, TaskbarGlomLevel, % vState
;note: WM_SETTINGCHANGE is the same as WM_WININICHANGE
SendMessage, 0x1A,,,, ahk_class Shell_TrayWnd ;WM_SETTINGCHANGE := 0x1A
WinSet, Redraw,, ahk_class Shell_TrayWnd
return
;==================================================
;this is a fallback method, I recommend using the RegWrite/SendMessage/WinSet Redraw method
;w:: ;taskbar - toggle always/never combine (tested on Windows 7)
Run, % "rundll32 shell32.dll,Options_RunDLL 1" ;Taskbar and Start Menu Properties, Taskbar tab
vWinCriteria := "Taskbar and Start Menu Properties ahk_class #32770"
WinWaitActive, % vWinCriteria
SendMessage, 0x147, 0, 0, ComboBox2, % vWinCriteria
vNum := ErrorLevel+1
vNum := vNum=1?3:1
Control, Choose, % vNum, ComboBox2, % vWinCriteria
ControlSend, Button11, {Enter}, % vWinCriteria
return
Btw:
[get/set auto-hide/lock states]
Get taskbar autohide state? Solved - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 81#p179081