📄 il_0409.cpp
字号:
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
//------------------------------------------------------------------------------
//
// Copyright (C) 2004-2006,2007 Freescale Semiconductor, Inc. All Rights Reserved.
// THIS SOURCE CODE, AND ITS USE AND DISTRIBUTION, IS SUBJECT TO THE TERMS
// AND CONDITIONS OF THE APPLICABLE LICENSE AGREEMENT
//
//------------------------------------------------------------------------------
#include <windows.h>
#include <winuser.h>
#include <winuserm.h>
#include <LayMgr.h>
#include "InputLang.h"
#define VK_OEM_4 VK_LBRACKET // CE naming difference
#define VK_OEM_6 VK_RBRACKET // CE naming difference
#define VK_OEM_7 VK_APOSTROPHE // CE naming difference
#define VK_OEM_COMMA VK_COMMA // CE naming difference
#define VK_OEM_PERIOD VK_PERIOD // CE naming difference
#define VK_OEM_2 VK_SLASH // CE naming difference
#define VK_OEM_PLUS VK_EQUAL // CE naming difference
#define VK_OEM_MINUS VK_HYPHEN // CE naming difference
#define VK_OEM_3 VK_BACKQUOTE // CE naming difference
#define VK_OEM_5 VK_BACKSLASH // CE naming difference
#define VK_OEM_1 VK_SEMICOLON // CE naming difference
#define VK_OEM_WSCTRL 0 // No CE equivalent
#define VK_OEM_FINISH VK_DBE_KATAKANA // CE naming difference
#define VK_OEM_JUMP 0 // No CE equivalent
#define VK_OEM_BACKTAB VK_DBE_ROMAN // CE naming difference
#define VK_OEM_AUTO VK_DBE_SBCSCHAR // CE naming difference
#define VK_OEM_PA3 0 // No CE equivalent
#define VK_OEM_RESET 0 // No CE equivalent
#define VK_ABNT_C1 0 // No CE equivalent
#define VK_OEM_PA1 0 // No CE equivalent
#define VK_ABNT_C2 0 // No CE equivalent
#define VK_OEM_8 VK_OFF // CE naming difference
/***************************************************************************\
* aVkToBits[] - map Virtual Keys to Modifier Bits
*
* See InputLang.h for a full description.
*
* United States Keyboard has only three shifter keys:
* SHIFT (L & R) affects alphanumeric keys,
* CTRL (L & R) is used to generate control characters
* ALT (L & R) used for generating characters by number with numpad
\***************************************************************************/
static VK_TO_BIT aVkToBits[] = {
{ VK_SHIFT , KBDSHIFT },
{ VK_SYMBOL , KBDCTRL },
{ VK_CONTROL , KBDCTRL + KBDSHIFT },
{ VK_MENU , KBDALT },
{ 0 , 0 }
};
/***************************************************************************\
* aModification[] - map character modifier bits to modification number
*
* See InputLang.h for a full description.
*
/***************************************************************************/
static MODIFIERS CharModifiers = {
&aVkToBits[0],
3,
{
// Modification# // Keys Pressed
// ============= // =============
0, //
1, // Shift
2, // (Shift + Control) OR Symbol
3, // Control
}
};
/***************************************************************************\
*
* aVkToWch2[] - Virtual Key to WCHAR translation for 2 shift states
*
* Table attributes: Unordered Scan, null-terminated
*
* Search this table for an entry with a matching Virtual Key to find the
* corresponding un+ed and shifted WCHAR characters.
*
* Special values for VirtualKey (column 1)
* 0xff - dead chars for the previous entry
* 0 - terminate the list
*
* Special values for Attributes (column 2)
* CAPLOK bit - CAPS-LOCK affect this key like SHIFT
*
* Special values for wch[*] (column 3 & 4)
* WCH_NONE - No character
* WCH_DEAD - Dead Key (diaresis) or invalid (US keyboard has none)
* WCH_LGTR - Ligature (generates multiple characters)
*
\***************************************************************************/
static VK_TO_WCHARS1 aVkToWch1[] = {
{ VK_T0 , 0 , '0' },
{ VK_T1 , 0 , '1' },
{ VK_T2 , 0 , '2' },
{ VK_T3 , 0 , '3' },
{ VK_T4 , 0 , '4' },
{ VK_T5 , 0 , '5' },
{ VK_T6 , 0 , '6' },
{ VK_T7 , 0 , '7' },
{ VK_T8 , 0 , '8' },
{ VK_T9 , 0 , '9' },
{ VK_TSTAR , 0 , '*' },
{ VK_TPOUND , 0 , '#' },//upto here for the keypad
{ VK_NUMPAD0 , 0 , '0' },
{ VK_NUMPAD1 , 0 , '1' },
{ VK_NUMPAD2 , 0 , '2' },
{ VK_NUMPAD3 , 0 , '3' },
{ VK_NUMPAD4 , 0 , '4' },
{ VK_NUMPAD5 , 0 , '5' },
{ VK_NUMPAD6 , 0 , '6' },
{ VK_NUMPAD7 , 0 , '7' },
{ VK_NUMPAD8 , 0 , '8' },
{ VK_NUMPAD9 , 0 , '9' },
{ 0 , 0 , '\0' }
};
static VK_TO_WCHARS2 aVkToWch2[] = {
// | | Shift |
// |=========|=========|
{VK_OEM_3 ,0 ,'`' ,'~' },//All added for keyboard
{'1' ,0 ,'1' ,'!' },
{'3' ,0 ,'3' ,'#' },
{'4' ,0 ,'4' ,'$' },
{'5' ,0 ,'5' ,'%' },
{'7' ,0 ,'7' ,'&' },
{'8' ,0 ,'8' ,'*' },
{'9' ,0 ,'9' ,'(' },
{'0' ,0 ,'0' ,')' },
{VK_OEM_PLUS ,0 ,'=' ,'+' },
{VK_OEM_1 ,0 ,';' ,':' },
{VK_OEM_7 ,0 ,'\'' ,'\"' },
{VK_OEM_COMMA ,0 ,',' ,'<' },
{VK_OEM_PERIOD,0 ,'.' ,'>' },
{VK_OEM_2 ,0 ,'/' ,'?' },
{VK_DECIMAL ,0 ,'.' ,'.' },
{VK_TAB ,0 ,'\t' ,'\t' },
{VK_ADD ,0 ,'+' ,'+' },
{VK_DIVIDE ,0 ,'/' ,'/' },
{VK_MULTIPLY ,0 ,'*' ,'*' },
{VK_SUBTRACT ,0 ,'-' ,'-' },
{0 ,0 ,0 ,0 }
};
static VK_TO_WCHARS4 aVkToWch4[] = {
// | | Shift | S+Ctrl | Ctrl |
// |=========|=========|========|==========|
{VK_OEM_4 ,0 ,'[' ,'{' ,WCH_NONE, 0x001b },
{VK_OEM_6 ,0 ,']' ,'}' ,WCH_NONE, 0x001d },
{VK_OEM_5 ,0 ,'\\' ,'|' ,WCH_NONE, 0x001c },
{VK_OEM_102 ,0 ,'\\' ,'|' ,WCH_NONE, 0x001c },
{VK_ESCAPE ,0 ,0x001b ,0x001b ,WCH_NONE, 0x001b },
{VK_CANCEL ,0 ,0x0003 ,0x0003 ,WCH_NONE, 0x0003 },
{VK_BACK ,0 ,'\b' ,'\b' ,'\b' ,0x007f },
{VK_RETURN ,0 ,'\r' ,'\r' ,'\r' ,'\n' },
{VK_SPACE ,0 ,' ' ,' ' ,' ' ,' ' },
{0 ,0 ,0 ,0 ,0 , 0 }
};
static VK_TO_WCHARS3 aVkToWch3[] = {
// | | Shift |(S+Ctrl) |
// OR SYMBOL|
// |=========|=========|=========|
{'2' ,0 ,'2' ,'@' ,0x0000 },
{'6' ,0 ,'6' ,'^' ,0x001e },
{VK_OEM_MINUS ,0 ,'-' ,'_' ,0x001f },
{'Q' ,CAPLOK ,'q' ,'Q' ,'1' },
{'W' ,CAPLOK ,'w' ,'W' ,'2' },
{'E' ,CAPLOK ,'e' ,'E' ,'3' },
{'R' ,CAPLOK ,'r' ,'R' ,'4' },
{'T' ,CAPLOK ,'t' ,'T' ,'5' },
{'Y' ,CAPLOK ,'y' ,'Y' ,'6' },
{'U' ,CAPLOK ,'u' ,'U' ,'7' },
{'I' ,CAPLOK ,'i' ,'I' ,'8' },
{'O' ,CAPLOK ,'o' ,'O' ,'9' },
{'P' ,CAPLOK ,'p' ,'P' ,'0' },
{'A' ,CAPLOK ,'a' ,'A' ,':' },
{'S' ,CAPLOK ,'s' ,'S' ,'/' },
{'D' ,CAPLOK ,'d' ,'D' ,'+' },
{'F' ,CAPLOK ,'f' ,'F' ,'-' },
{'G' ,CAPLOK ,'g' ,'G' ,'*' },
{'H' ,CAPLOK ,'h' ,'H' ,'_' },
{'J' ,CAPLOK ,'j' ,'J' ,'\"' },
{'K' ,CAPLOK ,'k' ,'K' ,'\'' },
{'L' ,CAPLOK ,'l' ,'L' ,'@' },
{VK_TAB ,0 ,'\t' ,'\t' ,'\t' },
{'Z' ,CAPLOK ,'z' ,'Z' ,'$' },
{'X' ,CAPLOK ,'x' ,'X' ,'(' },
{'C' ,CAPLOK ,'c' ,'C' ,')' },
{'V' ,CAPLOK ,'v' ,'V' ,'#' },
{'B' ,CAPLOK ,'b' ,'B' ,'!' },
{'N' ,CAPLOK ,'n' ,'N' ,',' },
{'M' ,CAPLOK ,'m' ,'M' ,'?' },
{VK_PERIOD ,0 ,'.' ,'>' ,'%' },
{0 ,0 ,0 ,0 ,0 }
};
/***************************************************************************\
* aVkToWcharTable: table of pointers to Character Tables
*
* Describes the character tables and the order they should be searched.
\***************************************************************************/
static VK_TO_WCHAR_TABLE aVkToWcharTable[] = {
{ (PVK_TO_WCHARS1)aVkToWch3, 3, sizeof(aVkToWch3[0]) },
{ (PVK_TO_WCHARS1)aVkToWch4, 4, sizeof(aVkToWch4[0]) },
{ (PVK_TO_WCHARS1)aVkToWch2, 2, sizeof(aVkToWch2[0]) },
{ (PVK_TO_WCHARS1)aVkToWch1, 1, sizeof(aVkToWch1[0]) },
{ NULL, 0, 0 },
};
static const VKEY_TO_SCANCODE VKeyToXTScanCodeTable[] =
{
{ /* 00 */ 0, 0 },
{ /* 01 VK_LBUTTON */ 0, 0 },
{ /* 02 VK_RBUTTON */ 0, 0 },
{ /* 03 VK_CANCEL */ 0, 0 },
{ /* 04 VK_MBUTTON */ 0, 0 },
{ /* 05 */ 0, 0 },
{ /* 06 */ 0, 0 },
{ /* 07 */ 0, 0 },
{ /* 08 VK_BACK */ 0, 0x2f },
{ /* 09 VK_TAB */ 0, 0x05 },
{ /* 0A */ 0, 0 },
{ /* 0B */ 0, 0 },
{ /* 0C VK_CLEAR */ 0, 0 },
{ /* 0D VK_RETURN */ 0, 0x00 },
{ /* 0E */ 0, 0 },
{ /* 0F */ 0, 0 },
{ /* 10 VK_SHIFT */ 0, 0 },
{ /* 11 VK_CONTROL */ 0, 0 },
{ /* 12 VK_MENU */ 0, 0x0F },
{ /* 13 VK_PAUSE */ 0, 0 },
{ /* 14 VK_CAPITAL */ 0, 0x15 },
{ /* 15 VK_HANGUL */ 0, 0 },
{ /* 16 */ 0, 0 },
{ /* 17 VK_JUNJA */ 0, 0 },
{ /* 18 VK_FINAL */ 0, 0 },
{ /* 19 VK_HANJA */ 0, 0 },
{ /* 1A */ 0, 0 },
{ /* 1B VK_ESCAPE */ 0, 0x38 },
{ /* 1C VK_CONVERT */ 0, 0 },
{ /* 1D VK_NOCONVERT */ 0, 0 },
{ /* 1E */ 0, 0 },
{ /* 1F */ 0, 0 },
{ /* 20 VK_SPACE */ 0, 0x07 },
{ /* 21 VK_PRIOR */ 0, 0 },
{ /* 22 VK_NEXT */ 0, 0 },
{ /* 23 VK_END */ 0, 0 },
{ /* 24 VK_HOME */ 0, 0 },
{ /* 25 VK_LEFT */ 0, 0x20 },
{ /* 26 VK_UP */ 0, 0x08 },
{ /* 27 VK_RIGHT */ 0, 0x10 },
{ /* 28 VK_DOWN */ 0, 0x18 },
{ /* 29 VK_SELECT */ 0, 0 },
{ /* 2A VK_PRINT */ 0, 0 },
{ /* 2B VK_EXECUTE */ 0, 0 },
{ /* 2C VK_SNAPSHOT */ 0, 0 },
{ /* 2D VK_INSERT */ 0, 0 },
{ /* 2E VK_DELETE */ 0, 0 },
{ /* 2F VK_HELP */ 0, 0 },
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -