Admin Production ni-theme
Current Publication

GetKeyUnicode

LabWindows/CVI

GetKeyUnicode

int GetKeyUnicode (void);

Purpose

Waits for the user to press a key and then returns the Unicode key code as an integer value.

If the user has already pressed a key, the key value is returned immediately.

Note  GetKeyUnicode detects keystrokes only in the Standard I/O window or in the console window of a Windows console application. GetKeyUnicode does not detect keystrokes in windows you create with the User Interface Library.

(Linux) This function is not supported.

The values returned by GetKeyUnicode have the same format as the key values the User Interface Library uses for eventData1 of EVENT_KEYPRESS when the panel encoding is UTF-8. Refer to userint.h.

Parameters

None.

Return Value

Name Type Description
unicodeKeyCode int The value representing the key pressed by the user.

Unicode key codes are formed by packing a Unicode code point, a virtual key, and a modifier key. A modifier key is a <Shift> key, <Alt> key, or <Ctrl> key.
Note   Use UnpackKeyCodeUnicode to obtain the various elements of the Unicode key code. In order to use this function and the constants enumerated below, you must include userint.h in your program.

The following constants represent the modifier key:

VAL_SHIFT_MODIFIER
VAL_UNDERLINE_MODIFIER
VAL_MENUKEY_MODIFIER
VAL_SHIFT_AND_MENUKEY

The Unicode code point can represent any character, so only a single call to GetKeyUnicode is needed, unlike GetKey where two consecutive calls are needed to get the lead byte and the trail byte for multibyte characters.

Virtual keys are non-ASCII keys represented by the following key codes:

VAL_FWD_DELETE_VKEY
VAL_BACKSPACE_VKEY
VAL_ESC_VKEY
VAL_TAB_VKEY
VAL_ENTER_VKEY
VAL_UP_ARROW_VKEY
VAL_DOWN_ARROW_VKEY
VAL_LEFT_ARROW_VKEY
VAL_RIGHT_ARROW_VKEY
VAL_INSERT_VKEY
VAL_HOME_VKEY
VAL_END_VKEY
VAL_PAGE_UP_VKEY
VAL_PAGE_DOWN_VKEY
VAL_F1_VKEY
VAL_F2_VKEY
VAL_F3_VKEY
VAL_F4_VKEY
VAL_F5_VKEY
VAL_F6_VKEY
VAL_F7_VKEY
VAL_F8_VKEY
VAL_F9_VKEY
VAL_F10_VKEY
VAL_F11_VKEY
VAL_F12_VKEY

Additional Information

Library: Utility Library

Include file: utility.h

LabWindows/CVI compatibility: LabWindows/CVI 2020 and later

Example

Refer to utility\getkeyunicode.cws for an example of using the GetKeyUnicode function.