santhosh
santhosh

Reputation: 385

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

Upvotes: 5

Views: 6615

Answers (4)

Sneaky
Sneaky

Reputation: 61

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

Upvotes: 0

Franci Penov
Franci Penov

Reputation: 76021

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.

Upvotes: 7

Treb
Treb

Reputation: 20299

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.

Upvotes: 1

endian
endian

Reputation: 4294

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

Upvotes: 0

Related Questions