📄 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, Freescale Semiconductor, Inc. All Rights Reserved
// THIS SOURCE CODE IS CONFIDENTIAL AND PROPRIETARY AND MAY NOT
// BE USED OR DISTRIBUTED WITHOUT THE WRITTEN PERMISSION OF
// FREESCALE SEMICONDUCTOR, INC.
//
//------------------------------------------------------------------------------
#include <windows.h>
#include <winuser.h>
#include <winuserm.h>
#include <LayMgr.h>
#include "InputLang.h"
/***************************************************************************\
* 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_MENU , KBDALT },
{ 0 , 0 }
};
/***************************************************************************\
* aModification[] - map character modifier bits to modification number
*
* See InputLang.h for a full description.
*
\***************************************************************************/
static MODIFIERS CharModifiers = {
&aVkToBits[0],
2,
{
// Modification# // Keys Pressed
// ============= // =============
0, //
1, // Caps Lock (no shift key here)
2 // Symbol Key
}
};
/***************************************************************************\
*
* 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 , '#' },
{ 0 , 0 , '\0' }
};
static VK_TO_WCHARS2 aVkToWch2[] = {
// | | Shift |
// |=========|=========|
{'I' ,CAPLOK ,'i' ,'I' }
};
static VK_TO_WCHARS3 aVkToWch3[] = {
// | | Caps | Symbol |
// |=========|=========|=========|
{'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_BACK ,0 ,'\b' ,'\b' ,'\b' },
{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 ,'.' ,'.' ,'%' },
{VK_RETURN ,0 ,'\r' ,'\r' ,'\r' },
{VK_SPACE ,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)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 },
{ /* 30 '0' */ 0, 0x1b },
{ /* 31 '1' */ 0, 0x12 },
{ /* 32 '2' */ 0, 0x0a },
{ /* 33 '3' */ 0, 0x02 },
{ /* 34 '4' */ 0, 0x1a },
{ /* 35 '5' */ 0, 0x32 },
{ /* 36 '6' */ 0, 0x3a },
{ /* 37 '7' */ 0, 0x2a },
{ /* 38 '8' */ 0, 0x13 },
{ /* 39 '9' */ 0, 0x03 },
{ /* 3A */ 0, 0 },
{ /* 3B */ 0, 0 },
{ /* 3C */ 0, 0 },
{ /* 3D */ 0, 0 },
{ /* 3E */ 0, 0 },
{ /* 3F */ 0, 0 },
{ /* 40 */ 0, 0 },
{ /* 41 'A' */ 0, 0x04 },
{ /* 42 'B' */ 0, 0x06 },
{ /* 43 'C' */ 0, 0x2d },
{ /* 44 'D' */ 0, 0x14 },
{ /* 45 'E' */ 0, 0x1c },
{ /* 46 'F' */ 0, 0x24 },
{ /* 47 'G' */ 0, 0x3d },
{ /* 48 'H' */ 0, 0x0e },
{ /* 49 'I' */ 0, 0x3e },
{ /* 4A 'J' */ 0, 0x26 },
{ /* 4B 'K' */ 0, 0x2e },
{ /* 4C 'L' */ 0, 0x27 },
{ /* 4D 'M' */ 0, 0x1e },
{ /* 4E 'N' */ 0, 0x16 },
{ /* 4F 'O' */ 0, 0x3f },
{ /* 50 'P' */ 0, 0x37 },
{ /* 51 'Q' */ 0, 0x33 },
{ /* 52 'R' */ 0, 0x2c },
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -