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
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
User contributions licensed under CC BY-SA 3.0