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
可以在。net中创建COM组件和ActiveX控件(使用c#语言)。我上网搜索,但什么也没找到。谢谢,santhosh
4 个解决方案
#1
6
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.
声明接口并使用类实现它。如果您的参数/返回值不是OLE自动化兼容的(自定义结构、枚举等),您可能需要用MarshalAs属性来装饰它们。向两者添加GUID属性。将可合并属性添加到两者。或者,您可以用它标记程序集。使用tlbexp为本地客户生成一个类型库。
#2
1
Yes, it is possible, there is this article in CodeProject. A friend of mine tried it and had some trouble accessing the COM-object from his unmanaged app, though, so there are some pitfalls.
是的,这是可能的,在CodeProject中有这篇文章。我的一个朋友尝试过,但从他的非托管应用程序访问COM-object时遇到了一些麻烦,因此存在一些缺陷。
#3
0
I think you're looking for information on the "COM Callable Wrapper". Google for that, or a basic intro is here (I haven't read it): http://www.dnzone.com/ShowDetail.asp?NewsId=126
我想你是在寻找关于“COM可调用包装器”的信息。谷歌,或者基本的介绍在这里(我没有读过):http://www.dnzone.com/showdetail.asp?
#4
0
the .Net and COM interoperability Handbook by Alan Gordon ISBN 0-13-046130-X is an essential resource if you're doing a lot of interop stuff
如果你做了大量的互操作,那么Alan Gordon ISBN 0-13-046130-X的。net和COM互操作性手册是一个重要的资源。
#1
6
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.
声明接口并使用类实现它。如果您的参数/返回值不是OLE自动化兼容的(自定义结构、枚举等),您可能需要用MarshalAs属性来装饰它们。向两者添加GUID属性。将可合并属性添加到两者。或者,您可以用它标记程序集。使用tlbexp为本地客户生成一个类型库。
#2
1
Yes, it is possible, there is this article in CodeProject. A friend of mine tried it and had some trouble accessing the COM-object from his unmanaged app, though, so there are some pitfalls.
是的,这是可能的,在CodeProject中有这篇文章。我的一个朋友尝试过,但从他的非托管应用程序访问COM-object时遇到了一些麻烦,因此存在一些缺陷。
#3
0
I think you're looking for information on the "COM Callable Wrapper". Google for that, or a basic intro is here (I haven't read it): http://www.dnzone.com/ShowDetail.asp?NewsId=126
我想你是在寻找关于“COM可调用包装器”的信息。谷歌,或者基本的介绍在这里(我没有读过):http://www.dnzone.com/showdetail.asp?
#4
0
the .Net and COM interoperability Handbook by Alan Gordon ISBN 0-13-046130-X is an essential resource if you're doing a lot of interop stuff
如果你做了大量的互操作,那么Alan Gordon ISBN 0-13-046130-X的。net和COM互操作性手册是一个重要的资源。