在c#应用程序中使用第三方上下文菜单(用于Windows资源管理器)?

时间:2023-01-17 00:02:52

Unlike others who wish to add items to the Windows Explorer, I want to display a context menu within my application. Now you may be thinking, the class you are looking for is ContextMenu. Let me show you what I am interested in doing. Please excuse the small images...

与其他希望向Windows资源管理器添加项的用户不同,我希望在应用程序中显示上下文菜单。现在您可能在想,您正在寻找的类是ContextMenu。让我告诉你我对做什么感兴趣。请原谅这些小图片……

Here is what I currently have:

以下是我目前所拥有的:

在c#应用程序中使用第三方上下文菜单(用于Windows资源管理器)?

This is what I would like it to be:

这就是我想要的:

在c#应用程序中使用第三方上下文菜单(用于Windows资源管理器)?

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.

让我们抛开假设。我已经检测到用户已经安装了玳瑁色,他们所选择的项目在源代码控制之下。

My research thus far:

我的研究到目前为止:

Retrieving context menus - This is very useful. This is a c# library for the Windows Explorer (which can retrieve the context menu for a particular folder/file). However, even when testing out the example, it does not retrieve the TortoiseSVN options.

检索上下文菜单——这非常有用。这是Windows资源管理器的c#库(它可以检索特定文件夹/文件的上下文菜单)。然而,即使在测试示例时,它也不会检索玳瑁色选项。

Another context menu retrieval - Almost identical to the previous link (C# code again). Gets the Windows Explorer context menu minus the TortoiseSVN options.

另一个上下文菜单检索——几乎与前面的链接相同(还是c#代码)。获取Windows资源管理器上下文菜单减去玳瑁色选项。

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. 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."

用户似乎能够完成这一点——这似乎是一个处理SVN开发的电子邮件组。为什么在这里?也许是为了证明这是可以做到的。引用:“我正在使用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

编辑:尝试更好地利用标签和更集中的标题

2 个解决方案

#1


0  

Hopefully the following will get you started

希望下面的内容能让你开始学习

#2


0  

Rather than trying to pull from the Windows Explorer, ultimately I re-implemented the ContextMenu myself. Adding in the direct calls to TortoiseSVN (as previously mentioned). Not the super elegant solution I wanted but it worked of course!

我没有试图从Windows资源管理器中提取,最终我自己重新实现了ContextMenu。添加到直接调用玳瑁色(如前所述)。这不是我想要的非常优雅的解决方案,但它当然奏效了!

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). Other users may want to look into that if they try to accomplish a similar task.

我要注意的是,用户oefe指出,主要的问题可能是x86 vs x64(在我的开发机器上,玳瑁色vn被安装为x64)。如果其他用户试图完成类似的任务,他们可能想要调查一下。

#1


0  

Hopefully the following will get you started

希望下面的内容能让你开始学习

#2


0  

Rather than trying to pull from the Windows Explorer, ultimately I re-implemented the ContextMenu myself. Adding in the direct calls to TortoiseSVN (as previously mentioned). Not the super elegant solution I wanted but it worked of course!

我没有试图从Windows资源管理器中提取,最终我自己重新实现了ContextMenu。添加到直接调用玳瑁色(如前所述)。这不是我想要的非常优雅的解决方案,但它当然奏效了!

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). Other users may want to look into that if they try to accomplish a similar task.

我要注意的是,用户oefe指出,主要的问题可能是x86 vs x64(在我的开发机器上,玳瑁色vn被安装为x64)。如果其他用户试图完成类似的任务,他们可能想要调查一下。