WinAPI:Shell扩展提供的调用上下文菜单项 [英] WinAPI: Call context menu entry provided by shell extension

查看:69
本文介绍了WinAPI:Shell扩展提供的调用上下文菜单项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

软件Dropbox提供了一个Shell扩展,它将上下文菜单项添加到特定文件夹中的所有文件。其中之一将生成一个公共链接,以查看所选文件。

The software Dropbox provides an shell extension which adds context menu items to all files in a specific folder. One of these generates a public link to view the selected file.

在C#工具中,我希望在没有任何用户交互的情况下调用此条目。我想要实现与用户单击所选文件的上下文菜单项相同的行为。

In a C# tool I want to call this entry without any user interaction. I want to achieve the same behavior as if the user clicked on the context menu item of a selected file.

我知道shell扩展是由DLL提供的,是否可以调用此DLL来实现预期的行为?

I know that the shell extension is provided by a DLL, is it possible to make a call to this DLL to achieve the expected behavior?

推荐答案

Shell扩展实现 IContextMenu ,并且可以在不显示菜单的情况下执行菜单命令(请参见此博客文章有关托管 IContextMenu的详细信息)

Shell extensions implement IContextMenu and it is possible to execute menu commands without showing a menu (See this blog post for details about "hosting" IContextMenu)

菜单,您将调用IContextMenu :: GetCommandString并查找特定的动词,如果Dropbox没有某个独特的动词,则您将不得不做一些棘手的事情,要么仅通过菜单文本进行匹配,要么调用Dropbox Shell扩展dll直接(DllGetClassObject导出)并伪造所有内容(假装为COM和Shell),或者如果您知道CLSID,则至少可以从COM获得帮助,然后执行外壳部分。

Once you have the menu, you would call IContextMenu::GetCommandString and look for a specific verb, if Dropbox does not have a somewhat unique verb, you are going to have to do something hacky, either match by menu text alone, or call the Dropbox shell extension dll directly (DllGetClassObject export) and fake everything (Pretend to be COM and shell) or if you know the CLSID, you can at least get help from COM and just do the shell part.

有一个名为运行菜单,可让您使用shell菜单/ IContextMenu(我确定您可以在某处找到副本)

There is a freeware tool called runmenu that allows you to play with shell menus/IContextMenu (I'm sure you can find a copy somewhere)

这篇关于WinAPI:Shell扩展提供的调用上下文菜单项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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