Command Menu Control


This sample implements the ICommand and IToolControl interfaces and is intended to be used within the ArcMap application. It illustrates an example of a command menu control. The example implementation builds a command menu and places, in that menu, a selection of the create commands found on the Drawing toolbar. The sample implementation is shown below.

How to use:
  1. Browse for and select the CMControl.dll using the 'Add From File' button on the Customize dialog.
  2. From the 'Samples' command category, drag the Command Menu Control onto a toolbar.
  3. Select the current command for the control by pressing the down arrow button. With the current command selected, the user can activate that command by pressing the main button of the control.
  4. To customize the commands that appear in the control the OnInitialize() function must be changed. This function is in the class implementation file CommandMenuControl.cpp. Using the code that is there as an example it is simple process to add more commands. The only thing the developer must know are the ProgIDs for the required commands. These ProgIDs can be located in the registry under the HKEY_CLASSES_ROOT. All the ArcObject ProgIDs start with esriCore.


Difficulty: Advanced

Visual C++
File Description
CMControl.cpp C++ Source file
CMControl.def Module Definition file, listing exported functions
CMControl.dsp Project file
CMControl.dsw Workspace file
CMControl.idl The IDL file for the sample
CMControl.rc Resource file
CMControldps.def Module definition file for proxy-stub Code Make file for proxy-stub code
CommandMenuControl.cpp Implementation file for CommandMenuControl COM object
CommandMenuControl.h Implementation file for CommandMenuControl COM object
CommandMenuControl.rgs Registry script file for CommandMenuControl COM Class
resource.h Resource file
StdAfx.cpp Precompiled Header file
StdAfx.h Precompiled Header file

Key Interfaces: IToolControl, ICommand