通过 Prism 和 Prism 公开功能 通信互操作

发布于 2024-07-14 23:57:11 字数 314 浏览 8 评论 0原文

如何通过 COM Interop 公开用 Prism 编写的类? 例如,给定以下接口:

TYPE
  IFoo = public interface
    property bar: string; read;
  end;


  FooImpl = class( IFoo )
  private
    function GetBar : string;
  public
    property bar: string; read GetBar;
  end;

在此示例中,假设 IFoo 是通过 TBIMP 导入并链接到项目的。

How does one go about exposing a class written in Prism via COM Interop? For example, given the following interface:

TYPE
  IFoo = public interface
    property bar: string; read;
  end;


  FooImpl = class( IFoo )
  private
    function GetBar : string;
  public
    property bar: string; read GetBar;
  end;

In this example, assume IFoo was imported via TLBIMP and linked to the project.

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

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

发布评论

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

评论(1

我的痛♀有谁懂 2024-07-21 23:57:11

使用 ComVisible 属性使程序集和/或类公开。 当使用 tlbexp.exe(.NET SDK 的一部分)时,您将获得作为 COM 接口的接口和作为 IFoo 的 CoClass 的类。 您可以选择使用 Guid 属性为您的接口和(co)类设置特定的 guid。

use the ComVisible attribute to make the assembly and/or class public. When using tlbexp.exe (part of the .NET SDK) you'll get the interface as a COM interface and the class as a CoClass for IFoo. Optionally you can use the Guid attribute to set a specific guid for your interface and (co) classes.

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