Debug ActiveX Control Using VS2010

Method 1:

Link:Debugging COM and ActiveX

Link:How to: Debug an ActiveX Control

Step1:Code test html.

<HTML>
	<HEAD>
		<TITLE>Test ActiveX</TITLE>
	</HEAD>
	<BODY>
		<OBJECT ID="MyActiveX" WIDTH=800 HEIGHT=600
		 CLASSID="CLSID:5228A02F-8FBD-424C-B457-EEBD4E748504">
			<PARAM NAME="_Version" VALUE="65536">
			<PARAM NAME="_ExtentX" VALUE="4657">
			<PARAM NAME="_ExtentY" VALUE="4075">
			<PARAM NAME="_StockProps" VALUE="0">
		</OBJECT>
	</BODY>
</HTML>


Step2:Set debug option in VS2010.

Right click the project and select "Properties" tab. Then select Debugging item in the Properties Pages and configure "Command" and "CommandArgs" arguments.

command: C:/Program Files/Internet Explorer/iexplore.exe  (Local IE path)

command arguments: C:/test.htm (test.html file path)


Step3: Register ActiveX control using full path.

If not, there will be an error:The sepcified module could not be found.


Step4: Sep break point in VS2010 where the implement code you want to debug. Then press F5 to run the program.


Note:IE8 is multi-thread by default, doesn't support ActiveX debug. So, you must modify the registry as following:

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]

"TabProcGrowth"=dword:00000000


原文地址:https://www.cnblogs.com/yefengmeander/p/2887527.html