I am trying to build a sample app to check pinning functionality. I came across this article https://learn.microsoft.com/en-us/windows/apps/design/shell/pin-to-taskbar which demonstrates the step by step procedure. I just want to know if this is possible for WinForms and WPF as well or only for UWP apps
I was trying with winforms and was getting exception System.Runtime.InteropServices.COMException (0x80070490): Element not found. (0x80070490)
I'm not sure if there are other ways rather than WinRT APIs that could do it. But just talk from the UWP side, the TaskbarManager class you find in the document can't be used in normal desktop apps like WPF and WinForms. You will get exception when you are trying to get the TaskbarManager instance.
You might also check Raymond Chen's blog here: How did that program manage to pin itself to my taskbar when I installed it?