A collection of commands used by the ToolbarControl.
The CommandPool is used for managing the collection of commands used by the ToolbarControl, a ToolbarMenu, a ToolbarPalette, or the commands shared between several ToolbarControl's. The ToolbarControl manages its CommandPool itself in order to maintain its command items. If a ToolbarMenu or ToolbarPalette are added to a ToolbarControl they will automatically share the same CommandPool as the ToolbarControl. If a ToolbarMenu or ToolbarPalette are used standalone they will mange their own CommandPool.
Use the ISupportErrorInfo method InterfaceSupportsErrorInfo to determine if the object supports extended error information. If the object supports extended error info, VC++ developers should use the OLE/COM IErrorInfo interface to access the ErrorInfo object. Visual Basic developers should use the global error object Err to retrieve this extended error information.
|ICommandPool||Provides access to the contents of the command pool.|
|ICommandPool2||Provides access to the contents of the command pool.|
|ICommandPoolEdit||Provides access to members that control the command pool.|
|ISupportErrorInfo||Indicates whether a specific interface can return Automation error objects.|
The CommandPool is used for managing the collection of Command objects (including Tool and ToolControl objects) objects used by the ToolbarControl. Normally, the CommandPool is entirely managed by the ToolbarControl, a ToolbarMenu or a ToolbarPalette in order to maintain to its command items.
The main job of the CommandPool is to create Command objects from valid UID's and prevent multiple instances of the same Command being created. This ensures that if the same Command is added to multiple ToolbarControl's, there will be only one actual instance of that Command in the CommandPool. When a Command is added by passing the ICommandPoolEdit::AddCommand method a valid UID, the first time that UID is supplied, a brand new Command is created and the CommandPool gives this a UsageCount of 1. If another ToolbarControl passes the ICommandPoolEdit::AddCommand the same UID the CommandPool will return the existing Command and will increment the UsageCount to 2.
By default each ToolbarControl has its own CommandPool. To ensure Commands are shared amongst multiple ToolbarControls the same CommandPool object must be set into each ToolbarControl. ToolbarMenu and ToolbarPalette objects also use a CommandPool. If a ToolbarMenu or ToolbarPalette is added to a ToolbarControl it will automatically share the same CommandPool as the ToolbarControl.
Other tasks performed by the CommandPool are: