博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

win7 ie8 activex debug

Posted on 2013-05-31 10:07  bw_0927  阅读(355)  评论(0)    收藏  举报

今天想去调试几个以前写的ActiveX插件,发现居然无法进入断点。几番搜索之下,最终的解决方案如下:

在注册表中增加一个键值:
1) Browse to HKEY_LOCALMACHINE -> SOFTWARE -> Microsoft -> Internet Explorer -> Main
2) Add a dword under this key called TabProcGrowth
3) Set TabProcGrowth to 0

 

这么做的原因如下:

IE 8 has a feature called Loosely-Coupled Internet Explorer (LCIE) which results in IE running across multiple processes.
http://www.microsoft.com/windows/internet-explorer/beta/readiness/developers-existing.aspx#lcie

Older versions of the Visual Studio Debugger get confused by this and cannot figure out how to attach to the correct process. You can work around this by disabling the process growth feature of LCIE. 

也就是说IE8 有一个LCIE特性,使得IE以多进程的形式运行,旧版的VS调试器会因此产生错乱,不能够获取正确的线程,因此需要禁用该特性。

===================

win7下缺省使用IE8,使用vs2008 开发ActiveX时需要在IE中进行调试。


问题:使用IE直接打开测试用的 test.html ,可以正常加载控件,在浏览器中显示了一个椭圆,
但是如果使用vs2008 进行F5 调试来打开IE加载 test.html ,控件加载失败,浏览器中出现一个大红叉。


a、重启IE,重启vs2008 -- 还是不行
b、将 debug->command args 修改成绝对路径:D:\test.html
还是不行。

问题找到了,win7下有两个ie,如果使用64位的ie打开失败,使用32位ie打开是成功的


因此使用的IE需要是 C:\Program Files (x86)\Internet Explorer\iexplore.exe,而不是 C:\Program Files\Internet Explorer\iexplore.exe
搞定,收工 -- IE8 会产生多个进程,在调试之前,需要将IE修改成 
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main添加一个“TabProcGrowth=0”
64位的IE需要我们将activeX控件也编译成64位的才能用。
 

或者用以下方式设置:
***重点*** 调试前先设置IE8为单进程模式(  http://www.2cto.com/os/201108/101595.html )
运行gpedit.msc组策略管理器。在“计算机配置->管理模板->windows组件->Internet Explore”
中打开“选项卡进程增长”,设置为已启用,选项卡进程增长为0。应用之后IE8就进入单进程模式。
这时VS只要直接按F5就能直接进入调试进程