Outlook 插件与 VB Windows 窗体应用程序交互

发布于 2025-01-16 04:47:16 字数 136 浏览 3 评论 0原文

我正在尝试创建一个 Outlook 添加,右键单击邮件,会弹出一个特殊的弹出菜单,该菜单与我也在 Visual Studio 上创建的 VB Windows 窗体应用程序进行交互。

谁能指导我一些方法,使我能够进行这种互动?

谢谢

I'm trying to create an outlook add in where I rightclick on a mail and a special popup menu pops out that interacts with a VB Windows Form App that I also created on Visual studio.

Can anyone please guide me on a few methods that allow me to make such interaction possible?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

π浅易 2025-01-23 04:47:17

您的 VSTO 加载项可以被视为常规的基于 .net 的应用程序。因此,您可以使用标准 .net 工具在两个独立的应用程序(VSTO 加载项和 Windows 窗体应用程序)之间进行通信。

如果您有现有的 WinForms 应用程序,那么我假设您没有使用 .NET 5,因此您可以使用 Windows 通信基础 (WCF)。如果您使用 .NET 5 或更高版本的 WinForms,则无法使用 WCF; gRPC 是替代方案,但它不在 .Net 5 之前为 .Net 工作。WCF 被设计为适用于应用程序之间通信的大多数选项的高级接口。

如果您不需要客户端和服务器,那么这就是所谓的 点对点网络

选择在两个应用程序之间进行通信的技术后,您可以使用功能区回调来获取当前选定的项目。通常,按钮控件的 onAction 回调具有以下签名:

C#: void OnAction(IRibbonControl control)
VBA: Sub OnAction(control As IRibbonControl)
C++: HRESULT OnAction([in] IRibbonControl *pControl)
Visual Basic: Sub OnAction(control As IRibbonControl)

您可以使用 IRibbonControl 实例作为参数传递以获取 Context 属性值,表示包含以下内容的活动窗口触发回调过程的功能区用户界面。之后,您可以获取 Selection 对象并处理单击的所选项目。

Your VSTO add-in can be treated as a regular .net based application. So, you can use standard .net tools to communicate between two separate applications - your VSTO add-in and Windows Forms application.

If you have an existing WinForms application then I assume you are not using .NET 5 so you can use Windows Communication Foundation (WCF). If you are using .NET 5 or above for WinForms then you cannot use WCF; gRPC is the alternative and it does not work for .Net prior to .Net 5. WCF has been designed as a high-level interface to most options for communications among applications.

If you do not want a client and server then that would be what is called Peer-to-Peer Networking.

After choosing the technology to communicate between two applications you can grab the currently selected item by using ribbon callbacks. Typically the onAction callback for button controls has the following signature:

C#: void OnAction(IRibbonControl control)
VBA: Sub OnAction(control As IRibbonControl)
C++: HRESULT OnAction([in] IRibbonControl *pControl)
Visual Basic: Sub OnAction(control As IRibbonControl)

You can use the IRibbonControl instance passed as a parameter to get the Context property value which represents the active window containing the Ribbon user interface that triggers a callback procedure. After that you can get the Selection object and process the selected item clicked.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文