Share via


Associate an Existing Class with a Resource

OverviewHow Do I

Use the Select Class dialog box to associate a new dialog box, menu, toolbar, or accelerator resource with an existing class. You will use this dialog box if you created a class before you created the resource that the class should be associated with. The association makes the resource command IDs available for mapping when the class is selected in the ClassWizard Message Maps tab or in WizardBar.

Note   You can work more efficiently if you first create a resource and then use ClassWizard to associate a class with the resource.

To associate an existing class from the project with a resource

  1. Use the dialog, menu, toolbar, or accelerator editor to create a resource. For information on using these editors, see Resource Editor Topics (Specific to Visual C++).

  2. Double-click on the resource.

    ClassWizard appears, along with an Adding a Class dialog box, which prompts you to provide a class for the new resource. You can either create a new class or select an existing class.

  3. Click the button to select an existing class.

    The Select Class dialog appears, displaying a list of existing classes in the active project.

  4. Select a class from the list, then click the Select button.

    A message box asks if you want to substitute the resource ID for the class's current resource ID.

  5. Click OK.

    ClassWizard associates the resource with the specified class.