示例#1
0
文件: input.c 项目: mikekap/wine
/******************************************************************************
 *		MapVirtualKeyExA (USER32.@)
 */
UINT WINAPI MapVirtualKeyExA(UINT code, UINT maptype, HKL hkl)
{
    UINT ret;

    ret = MapVirtualKeyExW( code, maptype, hkl );
    if (maptype == MAPVK_VK_TO_CHAR)
    {
        BYTE ch = 0;
        WCHAR wch = ret;

        WideCharToMultiByte( CP_ACP, 0, &wch, 1, (LPSTR)&ch, 1, NULL, NULL );
        ret = ch;
    }
    return ret;
}
示例#2
0
// This is less nice but more compatible for Notepad and MSWord for example
void PressKey(wchar key, bool hold = false, bool release = false) {
    if ((key >= 'a' && key <= 'z') || (key >= 'A' && key <= 'Z') || (key >= '0' && key <= '9')) {
        HKL hKeyboardLayout = ::GetKeyboardLayout(0);
        SHORT nVK = VkKeyScanExW(key, hKeyboardLayout);
        UINT nScan = MapVirtualKeyExW(nVK, MAPVK_VK_TO_CHAR, hKeyboardLayout);
        if (!release)
            keybd_event((BYTE)nVK, (BYTE)nScan, 0, 0);
        if (!hold)
            keybd_event((BYTE)nVK, (BYTE)nScan, KEYEVENTF_KEYUP, 0);
    } else {
        String numStr = FormatIntDec(key, 5, '0');
        PressKeyVK(VK_LMENU, true);
        PressKeyVK(VK_NUMPAD0 + numStr[0] - '0');
        PressKeyVK(VK_NUMPAD0 + numStr[1] - '0');
        PressKeyVK(VK_NUMPAD0 + numStr[2] - '0');
        PressKeyVK(VK_NUMPAD0 + numStr[3] - '0');
        PressKeyVK(VK_NUMPAD0 + numStr[4] - '0');
        PressKeyVK(VK_LMENU, false, true);
    }
}
示例#3
0
文件: input.c 项目: mikekap/wine
/******************************************************************************
 *		MapVirtualKeyW (USER32.@)
 */
UINT WINAPI MapVirtualKeyW(UINT code, UINT maptype)
{
    return MapVirtualKeyExW(code, maptype, GetKeyboardLayout(0));
}
示例#4
0
文件: input.c 项目: howard5888/wineT
/******************************************************************************
 *		MapVirtualKeyExA (USER32.@)
 */
UINT WINAPI MapVirtualKeyExA(UINT code, UINT maptype, HKL hkl)
{
    return MapVirtualKeyExW(code, maptype, hkl);
}
示例#5
0
/*
 * @implemented
 */
UINT WINAPI
MapVirtualKeyW(UINT uCode,
               UINT uMapType)
{
    return MapVirtualKeyExW(uCode, uMapType, GetKeyboardLayout(0));
}
示例#6
-2
/*
 * @implemented
 */
UINT WINAPI
MapVirtualKeyExA(UINT uCode,
                 UINT uMapType,
                 HKL dwhkl)
{
    return MapVirtualKeyExW(uCode, uMapType, dwhkl);
}