Change pinned taskbar icon (windows 7)

后端 未结 9 1289
梦谈多话
梦谈多话 2020-11-29 22:45

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\

相关标签:
9条回答
  • 2020-11-29 23:13

    When you pin an application to the TaskBar, it simply creates a shortcut in the following directory:

    C:\Users\<User Name>\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar
    

    You should be able to identify where the shortcut is (ie, get KnownFolders and work from there. UserAppData should be the one), and then using P/Invoke (IShellLink), you can alter the icon that the shortcut is setup to use. The machine might need a reboot for this to take effect, but it should work.

    If you hold down Shift while right-clicking on the pinned application, and select Properties, you can see the Change Icon button for the shortcut. This is basically what you need to emulate with code.

    All of these things can definately be done with code, but whether you think they're any better than the registry setting is up to you.

    0 讨论(0)
  • 2020-11-29 23:13

    I can't test this right now unfortunately, but perhaps just creating a regular, good old shortcut might solve the problem? Create a shortcut to the app, change the icon, then pin the shortcut instead of the app itself?

    Will check when I can next get access to my Windows 7 machine...

    0 讨论(0)
  • 2020-11-29 23:15

    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

    There is a series of articles on the new Taskbar API by the debugging guru Sasha Goldshtein. You should have a look at the Overlay Icons and Progress Bars API.

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

    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).

    alt text alt text alt text

    I believe this should help you achieve what you want.

    0 讨论(0)
提交回复
热议问题