How To Debugging ActiveX Controls in Internet Explorer (167715)



The information in this article applies to:

  • Microsoft Internet Explorer (Programming) 4.0
  • Microsoft Internet Explorer (Programming) 5
  • Microsoft Internet Explorer (Programming) 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

  1. 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:
    1. Load the project into Visual Basic 5.0.
    2. From the File menu, select Make <YourProject>.ocx.
    3. Click the Options button and select the Compile tab.
    4. Select "Compile to Native Code" and check the option to "Create Symbolic Debug Info"
    5. Click OK to compile your component with debug symbols.
    6. 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.
    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++

  2. Set breakpoints in your control's code appropriately.
  3. 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."
  4. 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.
  5. 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.
  6. Once the Windows Shell has shut down completely, launch the debugging session, ignoring the warning that debugging symbols for Explorer.exe are not available.
  7. 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.
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.

REFERENCES

In the Visual C++ 5.0 Books Online navigate to

Platform, SDK and DDK Documentation\Platform SDK\

User Interface Services\Shell\Shell Extensions\ About Shell Extensions\Installing Handlers on Windows NT\ Debugging Tips


Modification Type:MinorLast Reviewed:7/15/2004
Keywords:kbFAQ kbhowto KB167715