This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ArcObjects namespaces > Controls > ESRI ArcGIS Controls > Interfaces > IC > ICommandPool Interface > ICommandPool.UsageCount Property (ArcObjects .NET 10.5 SDK) |
The number of items using the given command.
[Visual Basic .NET] Public Function get_UsageCount ( _ ByVal Command As ICommand _ ) As Integer
[C#] public int get_UsageCount ( ICommand Command );
[C++]
HRESULT get_UsageCount(
ICommand* Command,
long* pVal
);
[C++]
Parameters Command [in]
Command is a parameter of type ICommand pVal [out, retval] pVal is a parameter of type long
The UsageCount is normally managed by the ToolbarControl, and returns the number of times an instance of a Command is shared. When a command is added by passing the ICommandPoolEdit::AddCommand or ICommndPoolEdit::AddUID method a valid UID object, the first time that UID is supplied, a brand new Command is created and the CommandPool gives this a UsageCount of 1. The second time the same UID is passed in, the CommandPool will return the existing Command and will increment the UsageCount to 2.
Using the ICommndPoolEdit::Remove method will decrement the UsageCount by 1. When the UsageCount reaches 0 the Command is released from the CommandPool.
1036 800a040c: The supplied command does not exist in command pool
In C# use the get_UsageCount method, as indexed property accessors are not supported.