英文:
Is it possible to pin app programmatically in Winforms app on windows 10?
问题
我正在尝试构建一个示例应用程序来检查固定功能。我看到了这篇文章https://learn.microsoft.com/en-us/windows/apps/design/shell/pin-to-taskbar,它演示了逐步的过程。我只想知道这对WinForms和WPF是否也适用,还是只适用于UWP应用程序。
我尝试使用WinForms,但遇到了异常
System.Runtime.InteropServices.COMException (0x80070490):找不到元素。 (0x80070490)
英文:
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)
答案1
得分: 1
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 an 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?
英文:
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?
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论