Importing a Class into ClassWizard

OverviewHow Do I

In previous releases of Visual C++ it was necessary to import classes into your project so that ClassWizard could recognize them. This is no longer necessary.

If you want to use code from another project, there are two simple methods of doing so:

  • Insert the other project into the workspace

  • Insert components or controls from the Gallery into the active project

Inserting another project into the workspace

Open the project you want to work on, then, on the Project menu, click Insert Project into Workspace. This inserts the other project in its entirety into the workspace. All the code in the other project is then made available to the first project. ClassWizard displays the classes from the project selected in the Project drop-down list.

You must first store the class to be shared in the Gallery. To do so, go to the project containing the class to be shared, right-click the class in ClassView and on the shortcut menu click Add to Gallery. This stores the class as a component in the Gallery directory.

Open the project to which you want to add the class. On the Project menu, point to Add To Project, then click Components and Controls to open the Gallery. Select the class you previously stored there and insert it into the active project.

Note   If the new code you copy was not created by a Visual C++ wizard, you may have to rebuild the ClassWizard (.clw) file in order that ClassWizard can recognize it. See Rebuilding the ClassWizard (.clw) File. If the code you are importing does not already have wizard-generated comments in it, manually add the special-format comments the wizard uses to locate message-map entries. For more information on wizard-generated special-format comments, see .