创建 COM 组件和 ActiveX 控件 [英] Create COM component and ActiveX controls

查看:37
本文介绍了创建 COM 组件和 ActiveX 控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以在 .Net 中创建 COM 组件和 ActiveX 控件(使用 c# 语言).我搜索了互联网,但我什么也找不到.

谢谢,
桑托什

Is is possible to create COM component and ActiveX controls in .Net (using c# language). I searched internet but i could`t get anything.

Thanks,
santhosh

推荐答案

声明一个接口并用类实现它.
如果您有与 OLE 自动化不兼容的参数/返回值(自定义结构、枚举等),您可能需要使用 MarshalAs 属性.
向两者添加 GUID 属性.
向两者添加 COMVisible 属性.或者,您可以使用它标记程序集.
使用 tlbexp 为本机客户端生成类型库.

Declare an interface and implement it with class.
If you have parameters/return values that are not OLE Automation compatible (custom structs, enums and so on), you might need to decorate them with the MarshalAs attribute.
Add the GUID attribute to both.
Add the COMVisible attribute to both. Alternatively, you can mark the assembly with it.
Use tlbexp to generate a type library for native clients.

这篇关于创建 COM 组件和 ActiveX 控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆