简体   繁体   中英

Create COM component and ActiveX controls

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

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.

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.

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

Alan Gordon的.Net和COM互操作性手册ISBN 0-13-046130-X是一个必不可少的资源,如果你做了很多互操作的东西

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM