如何以编程方式更改 Windows 10 任务栏图标大小 [英] How to change Windows 10 taskbar icon size programmatically

查看:58
本文介绍了如何以编程方式更改 Windows 10 任务栏图标大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Windows 10 中,您可以在任务栏的小图标或大图标之间进行选择.右键单击任务栏并转到设置",可通过 UI 使用该设置:

In Windows 10, you can choose between small or big icons for the taskbar. The setting is available through the UI by right clicking on the taskbar and going to the Settings:

也可以通过注册表编辑器(regedit.exe)通过修改以下项来调整此设置:

It is also possible to adjust this setting through the registry editor (regedit.exe) by modifying the following key:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarSmallIcons

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarSmallIcons

大图标的值为 0,小图标的值为 1.但与 UI 设置相反,使用此方法,您需要注销并登录 Windows 用户才能更新任务栏(重新启动 explorer.exe 进程也可以,但这不是一种选择).

The value is 0 for big icons and 1 for small icons. But as opposed to the UI setting, with this method you need to log out and log in your Windows user for the taskbar to be updated (restarting explorer.exe process also works but that's not an option).

我希望能够以编程方式更新任务栏并在小图标或大图标之间进行选择.是否有任何 API 或任何更新任务栏的方法,以便它无需注销即可从注册表中读取?我的具体目标是在使用小屏幕(笔记本电脑上的那个)时自动显示小图标,在使用大屏幕(我的常规大工作屏幕)时自动显示大图标.

I would like to be able to update the taskbar and choose between small or big icons programmatically. Is there any API for this, or any way to update the taskbar so that it read from the registry without having to log off? My specific aim is to automatically show small icons when I'm using a small screen (the one on the laptop) and big icons when I'm using a big screen (my regular big working screen).

现在 适用于 Windows 的自适应任务栏 由于提供的解决方案而成为现实:

Now Adaptive Taskbar for Windows is a reality thanks to the provided solutions :D

推荐答案

在 Windows 10 之前,您可以 发送WM_SETTINGCHANGE 消息 到任务栏,但似乎 不再有效.您可能需要调试 Explorer.exe 才能弄清楚它现在是如何通知的.

Before Windows 10 you could send the WM_SETTINGCHANGE message to the taskbar but it seems like that no longer works. You might have to debug Explorer.exe to figure out how it is notified now.

我刚刚用一个简单的 C++ 应用程序对此进行了测试,如果您设置了一个特殊的 LPARAM 字符串,它也可以在 Windows 10 上运行:

I just tested this with a simple C++ app and if you set a special LPARAM string it also works on Windows 10:

SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, NULL, (LPARAM)L"TraySettings", SMTO_NOTIMEOUTIFNOTHUNG, 3000, NULL);

这篇关于如何以编程方式更改 Windows 10 任务栏图标大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆