Share via


Creating Add-ins Using Visual C++

Home Page (Add-ins)OverviewHow Do I ... TopicsFAQReference

With Visual C++ versions 5.0 and later, the easiest way to create an add-in is to use the Developer Studio Add-in Wizard. This wizard creates the basic code, which you can modify to suit your needs.

Note   The code created uses the ActiveX Template Library and the Microsoft Foundation Classes.

To create an add-in with Visual C++

  1. Design the add-in.

  2. On the File menu, click New.

  3. In the New dialog box, click the Projects tab.

  4. Select Developer Studio Add-in Wizard.

  5. In the Project Name box, enter a project name for the add-in, and then click OK.

  6. In the Developer Studio Add-in Wizard — Step 1 of 1 dialog box, do the following:

    • Enter a name and description for your add-in.

    • If you want a toolbar for buttons that carry out commands added by the add-in, check the Provides a toolbar box.

    • If you want event-handling code for the Developer Studio objects, check the Responds to Developer Studio events box.

      The wizard adds a code stub for each event. Then, you must complete the code for the events you want.

    • Click the Finish button.

  7. In the New Project Information dialog box, note the files created by the wizard and the directory in which the project is stored. Then, click OK.

    The wizard ends and Developer Studio displays the classes created for the add-in. For details about the files and classes produced by the wizard, see Understanding the Results of the Add-in Wizard.

  8. Customize the add-in command or add new commands.

    The Developer Studio Add-in Wizard automatically creates the code to add one command to Developer Studio. However, if you need to customize this command or add additional commands, you must modify the code. For details, see Adding Commands to the Visual C++ Developer Studio.

  9. Build the DLL for the add-in.

Tip   Always unregister an add-in before changing it. For example, if you want to move an add-in to a new directory on your computer, or if you want to change its programmatic identifier (progID), unregister it beforehand. To unregister an add-in, go to the command line, go to the directory containing the add-in, and then type the command regsvr32 /u myAddIn**.dll**, where myAddIn is the name of the add-in.