更改固定的任务栏图标(Windows 7)任务栏、图标、Windows

2023-09-02 21:10:17 作者:跟xx撒个娇

我wan't自定义Windows 7任务栏中显示的图标。 当我的应用程序正在运行,我可以通过改变主窗口中的图标做,但,当应用程序被固定,显示exe文件的图标。

I wan't to customize the icon displayed within the windows 7 taskbar. When my app is running, I can do it by changing main window icon but, when the app is pinned, the exe's icon is displayed.

如何设置为我的应用程序的任务栏图标,图标从一个嵌入exe文件中的不同?

How can I set the taskbar icon for my app to an icon different from the one embedded within the exe ?

没试过,这个solution可工作,但看起来脏脏的。

Not tried, this solution may work but looks dirty.

编辑:

我们的应用程序被编译一次,但根据配置文件,功能是启用或不那么它是一个产品或其他。我们不希望编译一个exe文件的每个产品。

Our app is compiled once but depending on config file, features are enabled or not so it's a product or another. We do not want to compile one exe for each product.

该解决方案为我的应用程序的多个实例可以安装在不同的pathes(所以你最终以相同的exe文件名称,但不同的图标!)上面可能无法正常工作,是设计不当此注册表项还是我失去了一些东西?

The solution above may not work as many instances of my app can be installed in different pathes (so you end up with the same exe file name but different icons!), is this registry key poorly designed or am I missing something?

推荐答案

修改下面的信息是有点过时;所有新的Windows 7位是现在可以作为一个托管API,可在这里:http://$c$c.msdn.microsoft.com/WindowsAPI$c$cPack

EDIT The info below is a bit obsolete; all new Windows 7 bits are now available as a managed API, available here: http://code.msdn.microsoft.com/WindowsAPICodePack

有一个series稿件由调试大师萨沙Goldshtein 中的新任务栏API。你应该有一个看Overlay图标和进度条API 。

您可以从 Windows 7任务栏开发资源下载示例code 微软code。你要找的是什么 IMClient 示例:

You can download the sample code from Windows 7 Taskbar Developer Resources on Microsoft Code. What you're looking for is the IMClient sample:

在IMClient示例演示了如何   任务栏覆盖图标和任务栏   进度条即可点亮了   应用程序的任务栏按钮,而不是   依靠额外的对话框或   在系统通知的图标   区(盘)。

The IMClient sample demonstrates how taskbar overlay icons and taskbar progress bars can light up an application’s taskbar button instead of relying on an additional dialog or on an icon in the system notification area (tray).

     

我相信这应该帮助你实现你想要的。

I believe this should help you achieve what you want.