设置自动隐藏 Windows 任务栏的命令或消息或 DLL 调用? [英] A command or message or DLL call to set automatic hiding of Windows taskbar?
问题描述
我需要以编程方式设置或切换自动隐藏 Windows 10 任务栏.绑定到热键的操作以提高生产力和便利性.是否有命令行命令或 DLL 调用可以实现相当于翻转以下开关:
I need to set or toggle auto-hiding of Windows 10 taskbar programmatically. An action bound to a hotkey for productivity and convenience. Is there a command-line command or a DLL call which allows to achieve equivalent of flipping the following switch:
目前我通过打开上面的设置窗口并发送按键进行搜索来实现这一点,然后是Downs和Space和Alt+F4 但速度慢且不可靠.
Currently I am achieving this by opening the above Settings window and sending keystrokes for search, followed by Downs and Space and Alt+F4 but it is slow and unreliable.
这个问题不是特定于语言的,因为 DLL 调用在任何地方看起来都差不多,尽管我的最终实现将在 AutoHotKey.
This question is not language-specific since DLL calls look pretty much the same everywhere, although my final implementation will be in AutoHotKey.
预期结果:运行该命令后,Windows 资源管理器将更改其行为,就像启用(或禁用或切换)设置在桌面模式下自动隐藏任务栏一样.
Expected result: After running the command, the Windows Explorer will change its behavior as if the setting Automatically hide the taskbar in desktop mode was enabled (or disabled or toggled).
推荐答案
ABM_SETSTATE 消息.
在找到合适的 Windows 消息后我在 实施://www.autohotkey.com/" rel="nofollow noreferrer">AutoHotKey:
It is ABM_SETSTATE message.
After finding the proper Windows message I have also found the implementation in AutoHotKey:
ABM_SETSTATE := 10
ABS_NORMAL := 0x0
ABS_AUTOHIDE := 0x1
ABS_ALWAYSONTOP := 0x2
VarSetCapacity(APPBARDATA, 36, 0)
Address := NumPut(36, APPBARDATA)
Address := NumPut(WinExist("ahk_class Shell_TrayWnd"), Address + 0)
NumPut(ABS_NORMAL, Address + 24)
DllCall("Shell32.dll\SHAppBarMessage", UInt, ABM_SETSTATE, UInt, &APPBARDATA)
将第二行中的参数从ABS_NORMAL
改为ABS_AUTOHIDE
,以达到预期的其他状态.
Change the parameter in the second line from the bottom from ABS_NORMAL
to ABS_AUTOHIDE
to achieve the expected other state.
这篇关于设置自动隐藏 Windows 任务栏的命令或消息或 DLL 调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!