.NET is there a way to discover the members of a COM-object

0

In our WPF-application that is hosted in IE we are retrieving some context info from a COM-object which has the type of System.__ComObject (JScriptTypeInfo). We retrieve data from it using its type:

Type type = obj.GetType();
object value = type.InvokeMember(name, BindingFlags.GetProperty | BindingFlags.IgnoreCase, null, obj, null);

where name is the property we want to retrieve. The problem is that some properties are retrieved but some are not - an exception is thrown (System.Runtime.InteropServices.COMException (0x80020006): Unknown name. (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME))

So is it possible to retrieve the names of all the properties of this COM-object and how?

TIA

.net
com
asked on Stack Overflow Aug 25, 2011 by Niccolo

1 Answer

1

A sample to use ITypeInfo to get the type information of an automation object in .Net can be found at Inspecting COM Objects With Reflection

answered on Stack Overflow Aug 25, 2011 by Sheng Jiang 蒋晟

User contributions licensed under CC BY-SA 3.0