在我的应用程序中打开 Shell Context/PopupMenu
Open Shell Context/PopupMenu in my application
我用 SFML 编写了自己的文件资源管理器。我将创建自己的弹出菜单,但我认为有些人还想使用项目(文件夹、文件、快捷方式)的默认选项。因此,我的弹出菜单中的选项之一是 "Open default context menu here"。但我不知道该怎么做。我做了一些研究,并阅读了很多线程、文章、WinAPI 文档和其他资源。我试过在另一个window中模拟右键,我试过模拟Shift+F10快捷键。现在我与菜单作斗争。但我仍然没有结果。
我在以前的文件资源管理器中看到了类似的东西。
必须有解决办法。
我找到了这个 Show system menu from another process (using WinForms, c#)
但这会激活标准 windows 菜单 (alt+space) 但我想要右键单击菜单 (Shift+F10)。
您无法弹出 file/folder 的默认右键单击菜单本身。但是您可以创建自己的菜单并使用与 file/folder 相关的菜单项填充它,并在单击时调用这些项目,方法是使用 file/folder 自己的 IContextMenu
界面。
简而言之,您获得所需 file/folder 的 IContextMenu
,例如通过 IShellFolder::GetUIObjectOf()
or IShellItem::BindToHandler()
,然后您使用 IContextMenu::QueryContextMenu()
方法来填充您的菜单与项目,以及从这些项目调用命令的 IContextMenu::InvokeCommand()
方法。
Raymond Chen 就此主题撰写了一系列文章,可见这项任务的复杂程度。 post 这里的信息太多了。
How to host an IContextMenu, part 1 – Initial foray
How to host an IContextMenu, part 2 – Displaying the context menu
How to host an IContextMenu, part 3 – Invocation location
How to host an IContextMenu, part 4 – Key context
How to host an IContextMenu, part 5 – Handling menu messages
How to host an IContextMenu, part 6 – Displaying menu help
How to host an IContextMenu, part 7 – Invoking the default verb
How to host an IContextMenu, part 8 – Optimizing for the default command
How to host an IContextMenu, part 9 – Adding custom commands
How to host an IContextMenu, part 10 – Composite extensions – groundwork
How to host an IContextMenu, part 11 – Composite extensions – composition
我用 SFML 编写了自己的文件资源管理器。我将创建自己的弹出菜单,但我认为有些人还想使用项目(文件夹、文件、快捷方式)的默认选项。因此,我的弹出菜单中的选项之一是 "Open default context menu here"。但我不知道该怎么做。我做了一些研究,并阅读了很多线程、文章、WinAPI 文档和其他资源。我试过在另一个window中模拟右键,我试过模拟Shift+F10快捷键。现在我与菜单作斗争。但我仍然没有结果。 我在以前的文件资源管理器中看到了类似的东西。 必须有解决办法。
我找到了这个 Show system menu from another process (using WinForms, c#) 但这会激活标准 windows 菜单 (alt+space) 但我想要右键单击菜单 (Shift+F10)。
您无法弹出 file/folder 的默认右键单击菜单本身。但是您可以创建自己的菜单并使用与 file/folder 相关的菜单项填充它,并在单击时调用这些项目,方法是使用 file/folder 自己的 IContextMenu
界面。
简而言之,您获得所需 file/folder 的 IContextMenu
,例如通过 IShellFolder::GetUIObjectOf()
or IShellItem::BindToHandler()
,然后您使用 IContextMenu::QueryContextMenu()
方法来填充您的菜单与项目,以及从这些项目调用命令的 IContextMenu::InvokeCommand()
方法。
Raymond Chen 就此主题撰写了一系列文章,可见这项任务的复杂程度。 post 这里的信息太多了。
How to host an IContextMenu, part 1 – Initial foray
How to host an IContextMenu, part 2 – Displaying the context menu
How to host an IContextMenu, part 3 – Invocation location
How to host an IContextMenu, part 4 – Key context
How to host an IContextMenu, part 5 – Handling menu messages
How to host an IContextMenu, part 6 – Displaying menu help
How to host an IContextMenu, part 7 – Invoking the default verb
How to host an IContextMenu, part 8 – Optimizing for the default command
How to host an IContextMenu, part 9 – Adding custom commands
How to host an IContextMenu, part 10 – Composite extensions – groundwork
How to host an IContextMenu, part 11 – Composite extensions – composition