5

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

4 Answers 4

7

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.

Sign up to request clarification or add additional context in comments.

Comments

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.

Comments

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

Comments

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

1 Comment

He's going the other way - accessing .NET via COM.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.