Change icon of group in taskbar (Win7)

怎甘沉沦 提交于 2019-12-02 13:53:36

问题


Using LoadImage I changed the icon of all the windows in a group. However the group icon does not change. How can I get the corresponding group to a window and set its icon?


回答1:


The group icon comes from the EXE file itself (in the case of multiple EXEs contributing to the same group, I imagine the taskbar has some algorithm to decide which EXE to pull the icon from). There is no official API to change the group icon. You would have to manipulate the Taskbar directly, which is not impossible but not trivial either.

Update: I just came across the following answer, maybe it will help you:

https://stackoverflow.com/a/219128/65863

Update: Apparently the Registry value in the above link only applies if the app is pinned to the Taskbar.




回答2:


Your issue is this: The icon does infact take the icon of the first WINDOW, not exe. HOWEVER, after setting the icons, you have to right click on the icon in the taskbar, then pin it, then unpin it. On unpin the taskbar icon now takes the first windows icon.

I don't know how to programatically do this to maybe @RemyLebeau knows. Maybe setClassLongPtr? Not sure.

Now when it's pinned you want to make it use the same icon, so set the registry value like @RemyLebeau suggested.

Also I don't know how to explain this, but after unpinning, and the icon takes, if you open the jump list, the icon reverts back to the exe's icon. This may be fixed with the registry setting for pinned icon, I'm not sure.

Wow so Win7 taskbar is so tweakish.

Edit: I tried setting my registry values and the icon didnt work. It might have to do something with: the registry entires that i found for TaskbarGroupIcon all had a data value ending with a comma and a number (ex: ,-4 in %SystemRoot%\System32\imageres.dll,-4)



来源:https://stackoverflow.com/questions/24273424/change-icon-of-group-in-taskbar-win7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!