ArcObjects Library Reference (Controls)  

ICommandPoolEdit.AddUID Method

Adds the given UID to the command pool and returns an array of command objects.

ERROR: Syntax information about ICommandPoolEdit.AddUID may not be in D:\ArcGIS\DotNet\ESRI.ArcGIS.Controls.dll

[C++]
HRESULT AddUID(
  IUID* UID,
  IArray** pArray
);
[C++]

Parameters

UID [in]

  UID is a parameter of type IUID

pArray [out, retval]

  pArray is a parameter of type IArray

Product Availability

Available with ArcGIS Engine.

Description

Adds commands to the CommandPool using the specified UID. The method searches the CommandPool for the specified UID. If the UID is found then that commands UsageCount is incremented by 1. If the UID is not found a new command is created and added to the CommandPool with a UsageCount of 1. The command is returned in an array.

If the specified UID is a command that implements the ICommandSubType interface, the method will return an array of all the commands, and if necessary create the command in the  CommandPool. Set the IUID::SubType property to a none zero value to add a specific command defined within the ICommandSubType object.

Errors Returned

1034 800a040a: The supplied command is invalid
1035 800a040b: The subtype specified for the command (possibly in a UID object) is invalid or out of range

[C#]
ICommandPoolEdit commandPoolEdit = (ICommandPoolEdit) axToolbarControl1.CommandPool;
UID uID = new UIDClass();
uID.Value = "MyCommandSubTypes.MyCommands";

IArray array = commandPoolEdit.AddUID(uID);
for (int i=0; i<= array.Count - 1; i++)
{
	ICommand command = (ICommand) array.get_Element(i);
	System.Windows.Forms.MessageBox.Show(command.Name);
}
[Visual Basic .NET]
Dim pCommandPoolEdit As ICommandPoolEdit
pCommandPoolEdit = AxToolbarControl1.CommandPool
Dim pUid As New UIDClass
pUid.Value = "MyCommandSubTypes.MyCommands"

Dim pArray As IArray, pCommand As ICommand, i As Long
pArray = pCommandPoolEdit.AddUID(pUid)
For i = 0 To pArray.Count - 1
    pCommand = pArray.Element(i)
    System.Windows.Forms.MessageBox.Show(pCommand.Name)
Next i

See Also

ICommandPoolEdit Interface