OnChar Method of the IInputEvents Interface

This method is implemented on the client-side. It is called by ABBYY FineReader Engine when a keystroke translates to a character in Image Viewer, Zoom Viewer, Text Editor, Text Validator, or Document Viewer.

It delivers to the client the character code, repeat count, and some additional information about the keystroke. With the help of this method it is possible to cancel the operation.



  int           Character,
  int           Count,
  int           Flags,


void OnChar(
  int      Character,
  int      Count,
  int      Flags,
  out bool Cancel

Visual Basic .NET

Sub OnChar( _
  Character As Integer, _
  Count As Integer, _
  Flags As Integer, _
  ByRef Cancel As Boolean _


[in] Contains the character code value of the key.
[in] Contains the repeat count, the number of times the keystroke is repeated when user holds down the key.
[in] Contains the scan code, key-transition code, previous key state, and context code, as shown in the following list:
Value Description
0-7 Specifies the scan code. The value depends on the original equipment manufacturer (OEM).
8 Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.
9-12 Used internally by Windows.
13 Specifies the context code. The value is 1 if the ALT key is held down while the key is pressed; otherwise, the value is 0.
14 Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up.
15 Specifies the transition state. The value is 1 if the key is being released, or it is 0 if the key is being pressed.
[out] You may set this variable to TRUE to indicate that the process should be terminated.

Return values

[C++ only] If this method returns a value other than S_OK, it indicates that an error occurred on the client-side, and in this case the value of the Cancel parameter is not taken into account.


The client implementation of this method must assure that all exceptions thrown inside the method are caught and handled and no exceptions are propagated outside the method. Propagation of an exception outside the method may lead to unpredictable results (such as program termination).

See also


03.07.2024 8:50:43

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.