通过 Prism 和 Prism 公开功能 通信互操作
如何通过 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 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.