开发者

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

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 i开发者_运维知识库t 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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜