Pinning a network program with a Jump List to the taskbar programmatically in windows 10 – Part 2

After learning how to pin to the Taskbar programmatically in part 1, the next step is to pin a program on the network. One easy solution commonly given is to pin another program such as calculator, or a local copy of the network program, and change the created shortcut to point to the program on the network. But this involves typing and clicking and is error-prone, which means inevitably some users will be unable to do it. We are software developers. We are supposed to be creating solutions to users’ problems, and we don’t want to bother them with these annoyances. So unless you plan on doing this manually for each one of your users, read on..

Pinning programs with a Jump List

There is another major drawback to the methods linked above. If your application uses a Jump list, it will not be displayed on the pinned button, it will appear on a new button and be gone when the program is closed, rendering the Jump list practically useless. What you get is something similar to this, and the underlying cause in some cases is actually the same.

The reason for this is that when you pin a program through explorer, the shortcut includes the AppID used in the Jump list. When you pin it using the method above, the shortcut doesn’t include the AppID, and the Jump list isn’t associated with it.

Putting it all together

So what we have to do, like in the solutions above, is to pin a local program such as notepad.exe, and change the properties of the shortcut that is created, including the appID, to the correct values, all programmatically. After that we notify the shell to update itself, so we can see the new icon.

I changed the program from the last post based on this article from emoacht, which is modified from another article based on another one which is ultimately a wrapper around the IShellLink interface.

You can download the source here, or a compiled version here.

The new program:

Here is the ShellLink wrapper which I took from emoacht and just added a few properties:

 

2 thoughts on “Pinning a network program with a Jump List to the taskbar programmatically in windows 10 – Part 2”

    1. Suppose your program is on the company network on Z:\companyapps\main.exe, it has a Jumplist and the appID is ‘main.prod’. You would run:
      Pinto10TB /pinnetwork /sn Main /id main.prod /si Z:\companyapps Z:\companyapps\main.exe.
      It will pin notepad.exe to the taskbar and then change all the properties of the shortcut to the ones you specify.
      That’s assuming you wrote the program and know the appID. If you don’t, let me know and I’ll update the post explaining an easy way to find it out.

Leave a Reply

Your email address will not be published. Required fields are marked *