[英]Use 3rd party context menu (for Windows Explorer) within a C# application?
Unlike others who wish to add items to the Windows Explorer, I want to display a context menu within my application. 与其他希望将项目添加到Windows资源管理器的人不同,我想在我的应用程序中显示一个上下文菜单。 Now you may be thinking, the class you are looking for is
ContextMenu
. 现在您可能正在考虑,您正在寻找的类是
ContextMenu
。 Let me show you what I am interested in doing. 让我告诉您我感兴趣的事情。 Please excuse the small images...
请原谅小图片...
Here is what I currently have: 这是我目前拥有的:
This is what I would like it to be: 这就是我想要的:
Let's get the assumptions out of the way. 让我们摆脱这些假设。 I've already detected that the user has TortoiseSVN installed and the item they are selecting is under source control.
我已经检测到用户已安装TortoiseSVN,并且他们选择的项目在源代码控制下。
My research thus far: 到目前为止,我的研究:
Retrieving context menus - This is very useful. 检索上下文菜单 -这非常有用。 This is ac# library for the Windows Explorer (which can retrieve the context menu for a particular folder/file).
这是Windows资源管理器的ac#库(可以检索特定文件夹/文件的上下文菜单)。 However, even when testing out the example, it does not retrieve the TortoiseSVN options.
但是,即使在测试示例时,它也不会检索TortoiseSVN选项。
Another context menu retrieval - Almost identical to the previous link (C# code again). 另一个上下文菜单检索 -与上一个链接几乎相同(再次为C#代码)。 Gets the Windows Explorer context menu minus the TortoiseSVN options.
获取Windows资源管理器上下文菜单减去TortoiseSVN选项。
Process to add context menu - I have just started reading these in-depth posts. 添加上下文菜单的过程 -我刚刚开始阅读这些深入的文章。 The answer may be within this text but it is going to take me some time to get through it.
答案可能在本文中,但要花费我一些时间才能完成。 If I have any luck with these, I will post back an answer.
如果我有这些运气,我会回发答案。
User appears to be able to accomplish this - This appears to be a email group that deals with SVN development. 用户似乎能够完成此任务 -这似乎是处理SVN开发的电子邮件组。 Why post it here?
为什么要在这里发布? Perhaps to prove that this can be done.
也许可以证明这是可以做到的。 To quote: "I'm playing with the TSVN shell context menu. I'm using the
IContextMenu.QueryContextMenu
(C++ code) method to access TSVN shell context menu and then I'm browsing trough the returned menu." 引用:“我正在使用TSVN Shell上下文菜单。我正在使用
IContextMenu.QueryContextMenu
(C ++代码)方法访问TSVN Shell上下文菜单,然后通过返回的菜单进行浏览。”
All in all, this seems like it should be a fairly straight forward thing to do and I am just missing one step. 总而言之,这似乎应该是一件相当简单的事情,而我只是缺少了一步。 Any and all suggestions are welcome.
任何和所有建议都欢迎。 Thanks!
谢谢!
Edits: Trying to make better use of tags and a more focused title 编辑:试图更好地利用标签和更具针对性的标题
Hopefully the following will get you started 希望以下内容能帮助您入门
Showing windows (file/directory) context menu in c# winforms application 在C#Winforms应用程序中显示Windows(文件/目录)上下文菜单
The above link contains the following answer that shows something similar to what you want 上面的链接包含以下答案 ,该答案显示的内容与您想要的类似
How do you show the Windows Explorer context menu from a C# application? 如何从C#应用程序显示Windows资源管理器上下文菜单?
Rather than trying to pull from the Windows Explorer, ultimately I re-implemented the ContextMenu myself. 最终,我没有亲自尝试从Windows资源管理器中拉取,而是重新实现了ContextMenu。 Adding in the direct calls to TortoiseSVN (as previously mentioned).
添加对TortoiseSVN的直接调用(如前所述)。 Not the super elegant solution I wanted but it worked of course!
不是我想要的超级优雅的解决方案,但它当然有效!
I will note that user oefe pointed out that the main issue could have been due to x86 vs x64 (TortoiseSVN was installed as x64 on my development machine). 我将注意到oefe用户指出,主要问题可能是由于x86与x64(在我的开发计算机上,TortoiseSVN作为x64安装的)。 Other users may want to look into that if they try to accomplish a similar task.
如果其他用户尝试完成类似的任务,则可能需要调查。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.