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

- 11,008
- 11
- 30
- 50

- 375
- 1
- 8
- 16
4 Answers
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.

- 74,861
- 18
- 132
- 169
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.

- 19,903
- 7
- 54
- 87
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

- 4,234
- 8
- 34
- 42
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

- 51
- 2
-
He's going the other way - accessing .NET via COM. – endian Oct 09 '08 at 12:51