OnKeyDown Method of the IInputEvents Interface

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

It delivers to the client the key code, repeat count, and modification keys used. With the help of this method it is possible to cancel the operation.

Syntax

C++

HRESULT OnKeyDown(
  int           KeyCode,
  int           Count,
  int           Flags,
  VARIANT_BOOL* Cancel
);
    

C#

void OnKeyDown(
  int      KeyCode,
  int      Count,
  int      Flags,
  out bool Cancel
);
    

Visual Basic .NET

Sub OnKeyDown( _
  KeyCode As Integer, _
  Count As Integer, _
  Flags As Integer, _
  ByRef Cancel As Boolean _
)
    

Parameters

KeyCode
[in] Specifies the virtual key code of the key which is pressed.
Count
[in] Contains the repeat count, the number of times the keystroke is repeated when user holds down the key.
Flags
[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.
Cancel
[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.

Remarks

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

IInputEvents

24.03.2023 8:51:52

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.