Creating Toolbar Buttons for Add-in Commands Programmatically

If you work with a previously created add-in, you may want to add new toolbar button for your commands.

The following steps show how to add the code for a button.

  1. Open the project for the add-in.

  2. In ClassView, expand the project's classes, and then expand the CPBAddIn class.

  3. Double-click the IDSAddIn::OnConnection method.

  4. Search for the code that adds the appropriate command. This code calls the IApplication::AddCommand method.

  5. After the AddCommand call, call the IApplication::AddCommandBarButton method if the bFirstTime parameter of the OnConnection method has a value of VARIANT_TRUE.

    This parameter directs Visual Studio to call AddCommandBarButton only when the user first connects the add-in to Visual Studio.

See Also

Creating Toolbar Buttons for Add-in Commands Visually

 Last updated on Friday, October 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.