From 91dd10ebcb7f8c568d92f88d95194267ad9fe2be Mon Sep 17 00:00:00 2001 From: RKrom Date: Fri, 14 Sep 2012 14:38:39 +0000 Subject: [PATCH] Added some debug information, hopefully this will tell us something. git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2032 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4 --- Greenshot/Helpers/IEInterop/IEContainer.cs | 6 ++++ GreenshotInterop/Interop/COMWrapper.cs | 35 ++++++++++++++-------- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/Greenshot/Helpers/IEInterop/IEContainer.cs b/Greenshot/Helpers/IEInterop/IEContainer.cs index c74246ffc..1544341e9 100644 --- a/Greenshot/Helpers/IEInterop/IEContainer.cs +++ b/Greenshot/Helpers/IEInterop/IEContainer.cs @@ -150,6 +150,12 @@ namespace Greenshot.Helpers.IEInterop { } catch (Exception ex) { LOG.Error("Error checking the compatibility mode:"); LOG.Error(ex); + try { + Type document3Type = COMWrapper.GetUnderlyingType(document3 as IDispatch); + COMWrapper.DumpTypeInfo(document3Type); + } catch (Exception exInternal) { + LOG.Error(exInternal); + } } Rectangle clientRectangle = contentWindow.WindowRectangle; try { diff --git a/GreenshotInterop/Interop/COMWrapper.cs b/GreenshotInterop/Interop/COMWrapper.cs index ade06c33d..a756c7f6f 100644 --- a/GreenshotInterop/Interop/COMWrapper.cs +++ b/GreenshotInterop/Interop/COMWrapper.cs @@ -365,7 +365,7 @@ namespace Greenshot.Interop { /// /// wrapperProxy to get the type from /// Type - public static Type GetUnderlyingType(object wrapperProxy) { + public static Type GetUnderlyingTypeForWrapper(object wrapperProxy) { Type returnType = null; COMWrapper wrapper = RemotingServices.GetRealProxy(wrapperProxy) as COMWrapper; if (wrapper != null) { @@ -381,32 +381,43 @@ namespace Greenshot.Interop { } /// - /// Dump the Type-Information for the COM type to the log, this uses reflection + /// Return the Type of a IDispatch /// - /// wrapperProxy to inspect - public static void DumpTypeInfo(object wrapperProxy) { - Type comType = COMWrapper.GetUnderlyingType(wrapperProxy); - if (comType == null) { - LOG.InfoFormat("Can't get Typeinformation"); - return; + /// IDispatch to get the type object for + /// Type of the IDispatch + public static Type GetUnderlyingType(IDispatch dispatch) { + Type returnType = null; + if (dispatch != null) { + int result = dispatch.GetTypeInfo(0, 0, out returnType); + if (result != 0) { + LOG.DebugFormat("GetTypeInfo : 0x{0} ({1})", result.ToString("X"), result); + } } - LOG.InfoFormat("Type information for COM object with name: {0}", comType.Name); + return returnType; + } + + /// + /// Dump the Type-Information for the Type to the log, this uses reflection + /// + /// Type to inspect + public static void DumpTypeInfo(Type type) { + LOG.InfoFormat("Type information for Type with name: {0}", type.Name); try { - foreach (MemberInfo memberInfo in comType.GetMembers()) { + foreach (MemberInfo memberInfo in type.GetMembers()) { LOG.InfoFormat("Member: {0};", memberInfo.ToString()); } } catch (Exception memberException) { LOG.Error(memberException); } try { - foreach (PropertyInfo propertyInfo in comType.GetProperties()) { + foreach (PropertyInfo propertyInfo in type.GetProperties()) { LOG.InfoFormat("Property: {0};", propertyInfo.ToString()); } } catch (Exception propertyException) { LOG.Error(propertyException); } try { - foreach (FieldInfo fieldInfo in comType.GetFields()) { + foreach (FieldInfo fieldInfo in type.GetFields()) { LOG.InfoFormat("Field: {0};", fieldInfo.ToString()); } } catch (Exception fieldException) {