使用.NET Windows外壳集成 [英] Windows Shell Integration using .NET

查看:113
本文介绍了使用.NET Windows外壳集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是使用.NET和C#中的探险家注册程序右键菜单的最简单/最佳方法是什么?
即我想能够在Windows资源管理器的右键点击物品,并获得了编辑与MyProgram

What's the easiest/best way to register your program in explorers right-click menu using .NET and C#?
i.e. I would like to be able to right-click on an item in windows explorer and get a "Edit with MyProgram"

这是最接近的教程我能找到但大多只是逢低进入的Win32从.NET也是不合时宜的。应如何进行现在做?

This is the closest thing to a tutorial I could find but it mostly just dips into Win32 from .NET and is also outdated. How should this be done now?

推荐答案

如果你只是想添加菜单项,然后一个外壳扩展是矫枉过正。你可以注册在其中运行你的EXE所选择的文件(S)为参数的注册表中的命令行。外壳扩展,如果你想改变浏览器的行为,添加自定义图标,或钩基于shell文件操作真的只有必需的。

If you just want to add menu items, then a shell extension is overkill. You can register a command line in the registry which will run your exe with the selected file(s) as the parameter. Shell extensions are really only required if you want to change explorer's behavior, add custom icons, or hook shell based file operations.

HTTP://www.$c$cproject.com/KB/外壳/ SimpleContextMenu.aspx

如果外壳扩展是你需要什么,你最好写一个瘦包装在非托管code调用到另一个过程,是通过某种跨进程通信信道的.NET应用程序。由于所有潜在版本问题,因此不建议加载.NET运行时到explorer进程。

If a shell extension is what you need, you're best writing a thin wrapper in unmanaged code that calls out to another process that is your .NET application through some sort of cross process communication channel. Due to all the potential versioning issues, it's not recommended to load the .NET runtime into the explorer process.

这篇关于使用.NET Windows外壳集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆