Add Component

Created:11/18/1999
Description:

This sample is an stand-alone executable that shows how to use the ComponentCategoryManager CoClass to programmatically add or remove components in dlls to particular component categories used by ArcMap or ArcCatalog. This sample demonstrates the most frequently used catagories. They are: ESRI Mx Commands, ESRI GX Commands, ESRI Mx CommandBars, ESRI GX CommandBars, ESRI Mx Extensions, and ESRI GX Extensions. You might have your own custom commands, toolbars, or extensions built in dlls by implementing ICommand, IToolBarDef, or IExtension before using this sample. For more information on how to implement ICommand, IToolBarDef, or IExtension, refer to related help topics or samples.

How to use:
  1. Make sure that your dll with the components you want to add is registered.
  2. Run AddComponent.exe.
  3. Always select the right category before you try to add or remove components. For example, if you want to add a custom command into ArcMap, you need to select "ESRI Mx Commands" in the list before you click "Add From File...".
  4. To add a component to a category, select a category and click "Add From File...". This opens the open file dialog. Browse for and select the designated dll file and click OK. This will add the component in the dll to the selected category. No component is added if you click Cancel in file dialog.
  5. To remove a component from a category, select a category and click "Delete From File...". This opens the open file dialog. Browse for and select the designated dll file and click OK. This will remove the component in the dll from the selected category. This doesn't delete the dll. No component is removed if you click Cancel in file dialog.
  6. Start ArcMap if the selected category name was ESRI Mx Commands, ESRI Mx CommandBars, or ESRI Mx Extensions. Check to see if the component was added or removed successfully by looking in the ArcMap Customize dialog. For example, if you added a custom command to ESRI Mx Commands, you should see the command listed on Commands panel of the Customize dialog.
  7. Start ArcCatalog if the selected category name was ESRI GX Commands, ESRI GX CommandBars, or ESRI GX Extensions. Check to see if the component was added or removed successfully by looking in the ArcCatalog Customize dialog. For example, if you added a custom command to ESRI GX Commands, you should see the command listed on the Commands panel of Customize dialog.
  8. Click Close to dismiss Add Component program.

Application:
ArcMap or ArcCatalog

Difficulty: Intermediate


Visual Basic
File Description
frmAddComponent.frm VB Form for the Add Component executable.
AddComponent.vbp Project for the Add Component executable.
AddComponent.exe Executable file for Add Component.


Key CoClasses: ComponentCategoryManager
Key Interfaces: IComponentCategoryManager
Key Members: IComponentCategoryManager::Setup