views:

94

answers:

2

Is there a way to handle "Pin this program to taskbar" user action in the code? Is there such an event in Taskbar API? My search didn't give any results.

The reason behind this: my X.exe is launched through some other Y.exe executable, and if user clicks 'Pin' while Y.exe is running, I want to change this shortcut to the actual X.exe.

Any ideas? Thanks.

A: 

I don't think this is possible. And I think it would also be kind of a security concern if it was possible to programmatically have a different application be pinned to the taskbar than the one which is running. I mean in your case you want to prevent the wrong application from being pinned... but what if other applications would try to exploit this and pin stuff which the user didn't want?

humbagumba
+2  A: 

Since it is possible to pin to taskbar an application that is not running it is possible to do it programatically as well. Since no information on it can be found, I suggest these ways of investigation:

  • create a test app with unique name, pin it to taskbar and search the registry for any entry with app's name
  • use Spy++ or an equivalent to see what messages are passed in the taskbar during the pin operation
AOI Karasu