Partager via


MapVirtualKey

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function translates, or maps, a virtual-key code into a scan code or character value, or translates a scan code into a virtual-key code.

Syntax

UINT MapVirtualKey( 
  UINT uCode, 
  UINT uMapType 
);

Parameters

  • uCode
    [in] Specifies the virtual-key code or scan code for a key.
  • uMapType
    [in] Specifies the translation to perform. The value of this parameter depends on the value of the uCode parameter

    Value Description

    0

    uCode is a virtual-key code and is translated into a scan code. If it is a virtual-key code that does not distinguish between left- and right-hand keys, the left-hand scan code is returned. If there is no translation, the function returns 0.

    1

    uCode is a scan code and is translated into a virtual-key code that does not distinguish between left- and right-hand keys. If there is no translation, the function returns 0.

    2

    uCode is a virtual-key code and is translated into an unshifted character value in the low-order word of the return value. Dead keys (diacritics) are indicated by setting the top bit of the return value. If there is no translation, the function returns 0.

    3

    uCode is a scan code and is translated into a virtual-key code that distinguishes between left- and right-hand keys. If there is no translation, the function returns 0.

Return Value

A character value indicates success. Zero indicates that there is no translation.

Requirements

Header winuser.h
Library Kbdui.lib
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

GetAsyncKeyState
GetKeyState
Keyboard Functions

Other Resources

Translating Scan Codes to Virtual-Key Codes
PFN_KEYBD_DRIVER_MAP_VIRTUAL_KEY