HOWTO: Debugging ActiveX Controls in IE 4.0 Browser

Last reviewed: November 26, 1997
Article ID: Q167715
The information in this article applies to:
  • Microsoft Internet Explorer (Programming), version 4.0

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:

   a. Load the project into Visual Basic 5.0.
   b. From the File menu, select Make <YourProject>.ocx.
   c. Click the Options button and select the Compile tab.
   d. Select "Compile to Native Code" and check the option to
      "Create Symbolic Debug Info"
   e. Click OK to compile your component with debug symbols.
   f. 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 more information, please see the following article in
   the Microsoft Knowledge Base:

      ARTICLE-ID: Q166275
      TITLE     : HOWTO: Debug a Native Code Visual Basic
                  Component in VC++

  • Set breakpoints in your control's code appropriately.

  • 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."

  • From the Windows Start menu on the taskbar, select Shutdown.

  • 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.

  • Once the Windows Shell has shut down completely, launch the debugging session, ignoring the warning that debugging symbols for Explorer.exe are not available.

  • 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
    
    Keywords          : AXSDKControls
    Version           : Win:4.0
    Platform          : WINDOWS
    Issue type        : kbhowto

  • ================================================================================


    THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

    Last reviewed: November 26, 1997
    © 1998 Microsoft Corporation. All rights reserved. Terms of Use.