ArcObjects Library Reference (Controls)  

ICommandPool.UsageCount Property

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

Product Availability

Available with ArcGIS Engine.

Description

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.

Errors Returned

1036 800a040c: The supplied command does not exist in command pool

[C#]

In C# use the get_UsageCount method, as indexed property accessors are not supported.

See Also

ICommandPool Interface

.NET Samples

Share a command pool between ToolbarControls (Code Files: ShareCommandPool) |