> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# RegisterUserCommand Method of the Commands Object

> RegisterUserCommand method of the Commands Object in ABBYY FineReader Engine Visual Components on Windows — This method registers a user-defined command.

This method registers a user-defined command. The command further may be added to a toolbar or executed using the [ICommands::DoCommand](/fine-reader/engine/visual-components-reference/supplementary-objects/commands/docommand-method) method.

## Syntax

### C++

```cpp theme={null}
HRESULT RegisterUserCommand(
  MenuItemEnum CommandId,
  BSTR         CommandText,
  BSTR         IconPath,
  int          HotKey
);
```

### C\#

```csharp theme={null}
void RegisterUserCommand(
  MenuItemEnum CommandId,
  string       CommandText,
  string       IconPath,
  int          HotKey
);
```

### Visual Basic .NET

```vb theme={null}
Sub RegisterUserCommand( _
  CommandId As MenuItemEnum, _
  CommandText As String, _
  IconPath As String, _
  HotKey As Integer _
)
```

## Parameters

CommandId

\[in] Specifies the ID assigned to the user command as a [MenuItemEnum](/fine-reader/engine/visual-components-reference/enumerations/menuitemenum) constant. Can have values MI\_CustomCommand1, ... , MI\_CustomCommand10.

CommandText

\[in] Specifies the text of the user command.

IconPath

\[in] Specifies the path to the file containing a BMP picture of 16х16 size that will be used as the icon for the command.

HotKey

\[in] Specifies the hot key for the command. The parameter has the same format as the returned value (LRESULT) of the Windows [SendMessage](http://msdn.microsoft.com/en-us/library/ms644950\(VS.85\).aspx) function for the [HKM\_GETHOTKEY](http://msdn.microsoft.com/en-us/library/windows/desktop/bb775235\(v=vs.85\).aspx) message sent. To obtain the hot key value in this format, you should pack the virtual key code of the hot key to the low-order byte of the value, and the key modifier that specifies the keys that define a hot key combination to the high-order byte. If you do not need to use a hot key for the command, pass 0 to this parameter. If another command uses this hot key, an error is returned. You can check availability of a hot key using the [ICommands::HasHotKey](/fine-reader/engine/visual-components-reference/supplementary-objects/commands/hashotkey-method) method.

## Return values

This method has no specific return values. It returns the [standard return values of ABBYY FineReader Engine functions](/fine-reader/engine/api-reference/return-codes).

## See also

[Commands](/fine-reader/engine/visual-components-reference/supplementary-objects/commands)

[UnregisterUserCommand](/fine-reader/engine/visual-components-reference/supplementary-objects/commands/unregisterusercommand-method)

[MenuItemEnum](/fine-reader/engine/visual-components-reference/enumerations/menuitemenum)
