1

In Windows 7 and up. You can right click and select "Pin icon to taskbar". If pinned I call thate "pinned" state. If it is not I call that "unpinned" state.

I was wondering if there was a way through WinAPI to detect if my application is pinned to the taskbar or not. Is this possible?

Blagoh
  • 1,225
  • 1
  • 14
  • 29
  • 3
    Why do you want to know this? – andlabs Jan 30 '15 at 21:19
  • 1
    Whether it's pinned or not is a user preference. What possible use could you make of this information? – Ken White Jan 30 '15 at 21:51
  • Just a curious observation: I think when we ask users "why?" in the comments it leads to XY haha. Anyways here's my take, I've been dealing a lot with `IPropertyStore` lately and came across this: `System.AppUserModel.StartPinOption` although the docs on this state ` pinned to the Start screen`, so this may not work on taskbar, the docs are here: https://msdn.microsoft.com/en-us/library/jj553605%28v=vs.85%29.aspx – Noitidart Jan 30 '15 at 23:03
  • Awesome question, it ended up helping me a ton for another situation I was in!! – Noitidart Feb 07 '15 at 23:59

1 Answers1

1

There is no programmatic access to pinned shortcuts because people would just abuse them.

For your specific case the least hacky way is probably to look for yourself in

%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar
Anders
  • 97,548
  • 12
  • 110
  • 164
  • 1
    He may also want to check the folders in `%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\ImplicitAppShortcuts`, also he will probably want to check the paths of the shortcut files there right? Wouldn't it be best to test the `System.AppUserModel.ID` of the shortcuts? Like test to see if it is of his app? Maybe I'm just working too much with `IPropertyStore` to suggest this haha. – Noitidart Jan 30 '15 at 23:05
  • @Noitidart We don't know if he has a System.AppUserModel.ID but yes, he would obviously have to check the shortcut targets... – Anders Jan 30 '15 at 23:15
  • Fantastic, this along with ImplicitAppShortcuts worked. Thanks fellahs. – Blagoh Feb 02 '15 at 23:14