c# wpf set link in the right-click context menu of windows

南楼画角 提交于 2021-02-09 10:52:49

问题


I want to set in the right-click menu of windows, a shortcut to my app. The goal is to select a document (image, pdf etc.) -> right-click -> 'Send with my app' ( and optionnaly open a certain class with arguments, like the files path)

I've saw some many possibilities to do that ...

but I would like to know the good way to do that with a c# wpf app.

The goal is to send an installation program to many clients to allow them to use the app, and set the entry on the context menu


回答1:


In order to show custom options in Windows context menu, you will need to update the registry. Here is how to do it

http://www.howtogeek.com/107965/how-to-add-any-application-shortcut-to-windows-explorers-context-menu/

Once done, in your wpf application, you can get the command line arguments passed using :

string[] args = Environment.GetCommandLineArgs();

from these args, you can extract any argument passed (file location etc)



来源:https://stackoverflow.com/questions/34176448/c-sharp-wpf-set-link-in-the-right-click-context-menu-of-windows

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!