Share via


Adding a Component to a Project

OverviewHow Do I

The Gallery stores links to all components registered on your machine in its Visual C++ Components folder. For a component that is not registered on your machine, you must first install it, using the vendor’s installation program, before you can add it to a project. You can use components to add features to existing projects.

You can also add components that you have previously created in other projects. Such components are called user-defined components and are stored as .OGX files in folders named after the project from which they originated. See Adding Items to the Gallery for more information. The Gallery easily adds user-created components (.OGX files) and Visual C++ components into your projects.

To obtain information about a registered component shown in the Gallery, select the item, then click the More Info button.

To add a component to a project

  1. Open the project workspace to which you want to add a component.

    If you have more than one project loaded in the workspace, select the appropriate project: On the Project menu, point to Set Active Project, and click the name.

  2. On the Project menu, point to Add To Project, then click Components and Controls.

  3. In the Components and Controls Gallery dialog box (the Gallery), expand the Visual C++ Components folder and select the component you want to add to your project.

  4. Click Insert.

  5. At this point you may be prompted with a confirmation dialog box that prompts you to specify the attributes and options of the particular component. The type of information you must confirm or provide depends on the component you are adding. User-defined components and some registered components do not require any confirmation.

  6. Click OK in the confirmation dialog box, if any.

    The Gallery copies the files and resources contained in the component to the active project. The component may modify existing project files and resources without adding any new files.

  7. Use ClassView to inspect the newly added component classes, and to see any associated resources.

What do you want to do?