如何获取 ShellNew 子菜单项 [英] How to Get ShellNew sub menu items

查看:37
本文介绍了如何获取 ShellNew 子菜单项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程序,我需要显示新建"上下文菜单的子菜单.即当我们右键单击桌面时,我们会获得新的上下文菜单项,点击新建时,我们会获得文件夹"、快捷方式"、文本文档"等.

I am working on an application in that I need to display the sub menu of "New" context menu. i.e. when we right click on the desktop, we get new context menu item, on clicking on new, we get "Folder", "shortcut", "Text Document" and etc.

我的问题是-

  1. 是否有任何 API 可以获取列表到新的子菜单?
  2. 还有获取发送到"子菜单的API吗?

推荐答案

NewSend To 菜单项是实现 IContextMenu(2,3) 接口.New shell 扩展的 CLSID 为 {D969A300-E7FF-11d0-A93B-00A0C90F2719}Send To shell 扩展的 CLSID是 {7BA4C740-9E81-11CF-99D3-00AA004AE837}.所以你需要为IContextMenu接口实现宿主.

The New and Send To menu items are simple shell extensions which implement the IContextMenu(2,3) interfaces. The CLSID of the New shell extension is {D969A300-E7FF-11d0-A93B-00A0C90F2719}, and the CLSID of the Send To shell extension is {7BA4C740-9E81-11CF-99D3-00AA004AE837}. So you need to implement the host for IContextMenu interface.

  1. 创建一个 COM 对象

  1. Create one of the COM objects

查询IContextMenuIShellExtInit

调用IShellExtInit.Initialize()

创建临时菜单

调用IContextMenu.QueryContextMenu()

在临时菜单中,您将拥有所有可用的命令.

In the temp menu, you will have all of the available commands.

  1. 运行命令调用 IContextMenu.InvokeCommand().

您可以在 Old New Thing 博客中找到许多详细信息:

A lot of details you can find in The Old New Thing blog:

如何托管 IContextMenu,第 1 部分 - 初始进军

如何托管 IContextMenu,第 2 部分 - 显示上下文菜单

如何托管 IContextMenu,第 3 部分 - 调用位置

如何托管 IContextMenu,第 4 部分 - 关键上下文

如何托管 IContextMenu,第 5 部分 - 处理菜单消息

如何托管 IContextMenu,第 6 部分 - 显示菜单帮助

如何托管 IContextMenu,第 7 部分 - 调用默认动词

如何托管 IContextMenu,第 8 部分 - 优化对于默认命令

如何托管 IContextMenu,第 9 部分 - 添加自定义命令

如何托管 IContextMenu,第 10 部分 - 复合扩展 - 基础

如何托管 IContextMenu,第 11 部分 - 复合扩展 - 组合

这篇关于如何获取 ShellNew 子菜单项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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