Share via


Visual Basic Concepts

Testing and Debugging ActiveX Components

Visual Basic provides two different component debugging scenarios. For in-process components, you can load a test project (Standard Exe or ActiveX Exe) and one or more component projects into the development environment as a project group. You can run all the projects in the group together, and step directly from test project code into in-process component code.

Out-of-process components can be debugged using two instances of the development environment. One instance of Visual Basic runs the test project, while the second runs the component project. You can step directly from test project code into component code, and each instance of Visual Basic has its own set of breakpoints and watches.

Combinations of these scenarios are possible. You can debug an application that uses both in-process and out-of-process components, as shown in Figure 7.1.

Figure 7.1   Debugging in-process and out-of-process components

When an ActiveX Exe project is in run mode, like MyComponent in Figure 7.1, the client application (MyApp) can create objects and access their properties and methods. Each out-of-process component a client uses must be in its own instance of the development environment. The client application and all of its in-process components — DLLs and OCXs — can run together in a single instance of the development environment.

The following topics explain the basics of debugging and testing components.

For More Information*   There are special considerations for debugging and testing ActiveX control projects, and other project types that include private controls. See "Setting Up a New Control Project and Test Project" and "Debugging Controls" in "Building ActiveX Controls." Information specific to debugging and testing ActiveX Documents can be found in "Building ActiveX Documents." The fundamentals of debugging are covered in "Debugging Your Code and Handling Errors" in the *Visual Basic Programmer’s Guide.