I just wonder if that is possible.
I know simple types can be read through com interface. Does anyone have experience with complex types as structs and classes?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Simple types are passed through COM as Variants. Strings, ints, floats, IUnknown interfaces, and arrays of all of these can be carried in Variants.
C# and other .NET managed language types can be exposed through COM to unmanaged code, but COM will limit your options to basically interfaces. You should define interfaces in your managed code and tag them with the ComVisible attribute so that they can be seen by COM. Implement those interfaces on your classes or structures and you’re good to go.
I forget offhand how to instantiate a managed class from unmanaged code via COM, but search for .NET COM interop and it should be in there somewhere.