Need to call COM component using reflections in C#.NET

Posted by Usman on Stack Overflow See other posts from Stack Overflow or by Usman
Published on 2010-05-19T20:56:50Z Indexed on 2010/05/19 21:00 UTC
Read the original article Hit count: 579

Filed under:
|
|
|
|

Hello,

I need to determin the COM component(unmanaged code) type and invoke the exposed interface's methods using reflection in C#.NET at runtime.

1 -- First What member of "Type" tells that type is COM component and we can take CLSID at runtime? Is Type.COMObject? 2 -- I need to call methods of exposed interfaces as they called in unmanaged code using CoCreateInstance by passing CLSID and REFID ... I am using InvokeMember but it returns null or 0 as out parameter.

How to pass out parameter in this case.? Is there any need to pass out parameter? As all my COM unamanged code suppose to take las parameter as an OUT parameter and after executing it puts the result into that out param. But I've converted all my unmanged COM code to .NET managed assemblies using tlbimp.exe.

Regards Usman

© Stack Overflow or respective owner

Related posts about com

Related posts about c#