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

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

问题描述

时,可以在.net中(使用C#语言)创建COM组件和ActiveX控件。我搜索互联网,但我could`t得到任何东西。

谢谢,
santhosh

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自动化兼容的(自定义结构,枚举等),你可能需要与装饰他们的<一个参数/返回值href="http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshalasattribute.aspx">MarshalAs属性。
添加<一href="http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.guidattribute.aspx">GUID属性到两个。
添加<一href="http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.comvisibleattribute.aspx">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天全站免登陆