我可以让上下文菜单条目仅在应用程序运行时出现吗?
是否可以仅在我的应用程序运行时才显示鼠标右键单击条目?我的想法是,我希望人们能够右键单击 Windows 资源管理器中的文件,并能够选择一个条目“通过电子邮件将此文件发送给技术支持”,但我需要运行我的应用程序才能做到这一点,所以我希望当我的应用程序未运行时该条目消失。
我想我的问题的第二部分是如何实现该功能 - 即,如果应用程序已经在运行,我怎样才能从 Windows 资源管理器中识别并执行我的应用程序的右键单击菜单项单击,或者我必须有一个只向主应用程序传递消息的小应用程序?
Is is possible to have right-mouse-click entries only appear when my application is running? What I am thinking is that I want people to be able to right-click a file in windows explorer and be able to select an entry "Email this file to technical support", but I need my app to be running in order to do that, so I want the entry to disappear when my app isn't running.
I guess the second part of my question is how to implement that function - i.e. how can I get a right-click menu entry click from Windows Explorer recognised and acted on my my app if the app is already running, or will I have to have a minion app that just passes a message to the main app?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
shell 上下文菜单扩展可以轻松决定是否创建任何菜单项。更改对
IContextMenu.QueryContextMenu
的处理 相应的方法。 (Delphi 附带了一个用于上下文菜单扩展的示例项目。如果您还没有,请从那里开始。)另一种选择是保持菜单项始终可见。如果您的应用程序未运行,请先让菜单扩展启动您的程序。为什么用户必须担心做事的顺序?
A shell context-menu extension can decide whether to create any menu items easily enough. Change your handling of the
IContextMenu.QueryContextMenu
method accordingly. (Delphi comes with a sample project for context-menu extensions. Start from there if you don't already have one.)Another option is to keep the menu item visible all the time. If your application isn't running, then have the menu extension start your program first. Why should the user have to worry about what order to do things?