该机器已经安装了 .net framework 2.0及语言包。程序中我引用了 MSHTML 和 SHDocVw.dll 是个读取网页的程序。一开始程序不能运行,然后我复制了一个Microsoft.mshtml.dll到应用程序文件夹,程序可以打开窗口运行,但运行中出错(也就是刚开始运行,但可以看到已经打开网页)。错误如下:那位大侠给看看。 无法将类型为“System.__ComObject”的 COM 对象强制转换为类类型“mshtml.HTMLImgClass”。进入 CLR 且不支持 IProvideClassInfo 或没有注册任何互操作程序集的 COM 组件都将包装在 __ComObject 类型中。这种类型的实例不能强制转换为任何其他类;不过,只要基础 COM 组件支持对接口 IID 的 QueryInterface 调用,就能将这些实例强制转换为接口。 以下是详细信息: 有关调用实时(JIT)调试而不是此对话框的详细信息,
请参见此消息的结尾。 ************** 异常文本 **************
System.InvalidCastException: 无法将类型为“System.__ComObject”的 COM 对象强制转换为类类型“mshtml.HTMLImgClass”。进入 CLR 且不支持 IProvideClassInfo 或没有注册任何互操作程序集的 COM 组件都将包装在 __ComObject 类型中。这种类型的实例不能强制转换为任何其他类;不过,只要基础 COM 组件支持对接口 IID 的 QueryInterface 调用,就能将这些实例强制转换为接口。
在 xx.Form1.loginuser()
在 xx.Form1.登陆()
在 xx.Form1.主时间驱动(Object sender, EventArgs e)
在 System.Windows.Forms.Timer.OnTick(EventArgs e)
在 System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** 已加载的程序集 **************
mscorlib
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.832 (QFE.050727-8300)
基本代码: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
xx
程序集版本: 1.0.0.0
Win32 版本: 1.0.0.0
基本代码: file:///D:/Program%20Files/DDY/xx.exe
----------------------------------------
System.Windows.Forms
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.832 (QFE.050727-8300)
基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.832 (QFE.050727-8300)
基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.832 (QFE.050727-8300)
基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Microsoft.mshtml
程序集版本: 7.0.3300.0
Win32 版本: 7.0.3300.0
基本代码: file:///D:/Program%20Files/DDY/Microsoft.mshtml.DLL
----------------------------------------
AxInterop.SHDocVw
程序集版本: 1.1.0.0
Win32 版本: 1.1.0.0
基本代码: file:///D:/Program%20Files/DDY/AxInterop.SHDocVw.DLL
----------------------------------------
System.Windows.Forms.resources
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.42 (RTM.050727-4200)
基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms.resources/2.0.0.0_zh-CHS_b77a5c561934e089/System.Windows.Forms.resources.dll
----------------------------------------
Interop.SHDocVw
程序集版本: 1.1.0.0
Win32 版本: 1.1.0.0
基本代码: file:///D:/Program%20Files/DDY/Interop.SHDocVw.DLL
----------------------------------------
Accessibility
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.42 (RTM.050727-4200)
基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
mscorlib.resources
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.832 (QFE.050727-8300)
基本代码: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
---------------------------------------- ************** JIT 调试 **************
要启用实时(JIT)调试,
该应用程序或计算机的 .config 文件(machine.config)的 system.windows.forms 节中必须设置
jitDebugging 值。
编译应用程序时还必须启用
调试。 例如: <configuration>
<system.windows.forms jitDebugging="true" />
</configuration> 启用 JIT 调试后,任何无法处理的异常
都将被发送到在此计算机上注册的 JIT 调试器,
而不是由此对话框处理。
请参见此消息的结尾。 ************** 异常文本 **************
System.InvalidCastException: 无法将类型为“System.__ComObject”的 COM 对象强制转换为类类型“mshtml.HTMLImgClass”。进入 CLR 且不支持 IProvideClassInfo 或没有注册任何互操作程序集的 COM 组件都将包装在 __ComObject 类型中。这种类型的实例不能强制转换为任何其他类;不过,只要基础 COM 组件支持对接口 IID 的 QueryInterface 调用,就能将这些实例强制转换为接口。
在 xx.Form1.loginuser()
在 xx.Form1.登陆()
在 xx.Form1.主时间驱动(Object sender, EventArgs e)
在 System.Windows.Forms.Timer.OnTick(EventArgs e)
在 System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** 已加载的程序集 **************
mscorlib
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.832 (QFE.050727-8300)
基本代码: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
xx
程序集版本: 1.0.0.0
Win32 版本: 1.0.0.0
基本代码: file:///D:/Program%20Files/DDY/xx.exe
----------------------------------------
System.Windows.Forms
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.832 (QFE.050727-8300)
基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.832 (QFE.050727-8300)
基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.832 (QFE.050727-8300)
基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Microsoft.mshtml
程序集版本: 7.0.3300.0
Win32 版本: 7.0.3300.0
基本代码: file:///D:/Program%20Files/DDY/Microsoft.mshtml.DLL
----------------------------------------
AxInterop.SHDocVw
程序集版本: 1.1.0.0
Win32 版本: 1.1.0.0
基本代码: file:///D:/Program%20Files/DDY/AxInterop.SHDocVw.DLL
----------------------------------------
System.Windows.Forms.resources
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.42 (RTM.050727-4200)
基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms.resources/2.0.0.0_zh-CHS_b77a5c561934e089/System.Windows.Forms.resources.dll
----------------------------------------
Interop.SHDocVw
程序集版本: 1.1.0.0
Win32 版本: 1.1.0.0
基本代码: file:///D:/Program%20Files/DDY/Interop.SHDocVw.DLL
----------------------------------------
Accessibility
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.42 (RTM.050727-4200)
基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
mscorlib.resources
程序集版本: 2.0.0.0
Win32 版本: 2.0.50727.832 (QFE.050727-8300)
基本代码: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
---------------------------------------- ************** JIT 调试 **************
要启用实时(JIT)调试,
该应用程序或计算机的 .config 文件(machine.config)的 system.windows.forms 节中必须设置
jitDebugging 值。
编译应用程序时还必须启用
调试。 例如: <configuration>
<system.windows.forms jitDebugging="true" />
</configuration> 启用 JIT 调试后,任何无法处理的异常
都将被发送到在此计算机上注册的 JIT 调试器,
而不是由此对话框处理。
----------------------------------------------------------------------------
你在那台机子上试着用regsvr32注册一下这两个COM文件