Skip to main content
This method registers a user-defined command. The command further may be added to a toolbar or executed using the ICommands::DoCommand method.

Syntax

C++

HRESULT RegisterUserCommand(
  MenuItemEnum CommandId,
  BSTR         CommandText,
  BSTR         IconPath,
  int          HotKey
);

C#

void RegisterUserCommand(
  MenuItemEnum CommandId,
  string       CommandText,
  string       IconPath,
  int          HotKey
);

Visual Basic .NET

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 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 function for the HKM_GETHOTKEY 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 method.

Return values

This method has no specific return values. It returns the standard return values of ABBYY FineReader Engine functions.

See also

Commands UnregisterUserCommand MenuItemEnum