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.
The following constants represent the modifier key: VAL_SHIFT_MODIFIER 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 |
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.