Microsoft KB Archive/167715

= How To Debugging ActiveX Controls in Internet Explorer =

Article ID: 167715

Article Last Modified on 7/15/2004

-

APPLIES TO


 * Microsoft Internet Explorer 4.0 128-Bit Edition
 * Microsoft Internet Explorer 5.0
 * Microsoft Internet Explorer 5.5

-



This article was previously published under Q167715



SUMMARY
In Internet Explorer 4.0 Integrated Browser Mode, the Windows shell and the Web browser run in the same process space. This poses a challenge to programmers who are attempting to debug their controls. This article lists a series of steps you can follow to reliably debug your ActiveX controls in the Visual C++ debugger running in Integrated Browser Mode.

This article covers debugging both Visual C++ and Visual Basic-created components.

NOTE: Alternatively, you can specify "Browse in a new process." To do this, click "Internet Options" from the View menu. Click the Advanced tab. Next, select "Browse in a new process."



MORE INFORMATION
 Given an ActiveX control project for which debug symbols and source are available, load the corresponding project into the Visual C++ debugger.

For components written in Visual Basic, ensure that the component contains debug information:  Load the project into Visual Basic 5.0. From the File menu, select Make .ocx. Click the Options button and select the Compile tab. Select "Compile to Native Code" and check the option to "Create Symbolic Debug Info" Click OK to compile your component with debug symbols.</li> To load the project into the Visual C++ debugger, select Open Workspace from the Visual C++ File menu, setting "Files of Type" to All Files (*.*), and then select your compiled component.</li></ol>

For additional information about, please see the following article in the Microsoft Knowledge Base:

166275 How To Debug a Native Code Visual Basic Component in VC++

</li> Set breakpoints in your control's code appropriately.</li> Specify Explorer.exe as the executable to be used for debugging. In Visual C++ version 5.0, this can be set from the Project menu, by clicking Settings, and selecting the Debug tab. Under "Executable for Debug Session," specify Explorer.Exe or click on the arrow and select "Default Web Browser."</li> Under "Program Arguments," type "-new". This will launch a new Internet Explorer process that the debugger can attach to, as opposed to launching a new thread.

As an alternative, you can follow steps 1 through 3 and continue with the following:

From the Windows Start menu on the taskbar, select Shutdown.</li> When the "Shutdown Windows" dialog box appears, click "Close all programs and logon as a different user," hold down the CTRL+ALT+SHIFT keys, and click No. The Windows Shell including the taskbar will shut down, but the Windows session will not end. To toggle between applications use the ALT+TAB keys. To launch additional applications, use the Task Manager, accessible via CTRL+ALT+DELETE.</li> Once the Windows Shell has shut down completely, launch the debugging session, ignoring the warning that debugging symbols for Explorer.exe are not available.</li> Open a browser or Explorer window and specify the address of the HTML page that contains a reference to the control. Once the page is loaded, focus will jump to the debugger, which will be suspended on the first breakpoint set.</li></ol>

When you're finished debugging the control, the shell may need to be restarted using the Task Manager.
 * 1) Under Windows 95, double-click anywhere on the desktop to bring up the Task Manager. Under Windows NT, press CTRL+ALT+DELETE and click the Task Manager button.
 * 2) From the Task Manager's File Menu, select Run and enter the path to Explorer.exe to restart the shell.

<div class="references_section">