请问与字母‘W’对应的数字是从哪里来的?

lettermail2 2003-08-09 08:51:00
请问与字母‘W’对应的数字是从哪里来的?
某个游戏的程序里面, 定义play1up 为w 键, 请问0x1157 是怎样来的?

#define PLAY1UP 0x1157 /*上移--'W'*/
...全文
272 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
wanderman 2003-08-09
  • 打赏
  • 举报
回复
一起学习
blackman1010 2003-08-09
  • 打赏
  • 举报
回复
接分……


{ 0x011b, 0x011b, 0x011b, 0x0100 }, /* escape */
{ 0x0231, 0x0221, none, 0x7800 }, /* 1! */
{ 0x0332, 0x0340, 0x0300, 0x7900 }, /* 2@ */
{ 0x0433, 0x0423, none, 0x7a00 }, /* 3# */
{ 0x0534, 0x0524, none, 0x7b00 }, /* 4$ */
{ 0x0635, 0x0625, none, 0x7c00 }, /* 5% */
{ 0x0736, 0x075e, 0x071e, 0x7d00 }, /* 6^ */
{ 0x0837, 0x0826, none, 0x7e00 }, /* 7& */
{ 0x0938, 0x092a, none, 0x7f00 }, /* 8* */
{ 0x0a39, 0x0a28, none, 0x8000 }, /* 9( */
{ 0x0b30, 0x0b29, none, 0x8100 }, /* 0) */
{ 0x0c2d, 0x0c5f, 0x0c1f, 0x8200 }, /* -_ */
{ 0x0d3d, 0x0d2b, none, 0x8300 }, /* =+ */
{ 0x0e08, 0x0e08, 0x0e7f, none }, /* backspace */
{ 0x0f09, 0x0f00, none, none }, /* tab */
{ 0x1071, 0x1051, 0x1011, 0x1000 }, /* Q */
{ 0x1177, 0x1157, 0x1117, 0x1100 }, /* W */
{ 0x1265, 0x1245, 0x1205, 0x1200 }, /* E */
{ 0x1372, 0x1352, 0x1312, 0x1300 }, /* R */
{ 0x1474, 0x1454, 0x1414, 0x1400 }, /* T */
{ 0x1579, 0x1559, 0x1519, 0x1500 }, /* Y */
{ 0x1675, 0x1655, 0x1615, 0x1600 }, /* U */
{ 0x1769, 0x1749, 0x1709, 0x1700 }, /* I */
{ 0x186f, 0x184f, 0x180f, 0x1800 }, /* O */
{ 0x1970, 0x1950, 0x1910, 0x1900 }, /* P */
{ 0x1a5b, 0x1a7b, 0x1a1b, none }, /* [{ */
{ 0x1b5d, 0x1b7d, 0x1b1d, none }, /* ]} */
{ 0x1c0d, 0x1c0d, 0x1c0a, none }, /* Enter */
{ none, none, none, none }, /* L Ctrl */
{ 0x1e61, 0x1e41, 0x1e01, 0x1e00 }, /* A */
{ 0x1f73, 0x1f53, 0x1f13, 0x1f00 }, /* S */
{ 0x2064, 0x2044, 0x2004, 0x2000 }, /* D */
{ 0x2166, 0x2146, 0x2106, 0x2100 }, /* F */
{ 0x2267, 0x2247, 0x2207, 0x2200 }, /* G */
{ 0x2368, 0x2348, 0x2308, 0x2300 }, /* H */
{ 0x246a, 0x244a, 0x240a, 0x2400 }, /* J */
{ 0x256b, 0x254b, 0x250b, 0x2500 }, /* K */
{ 0x266c, 0x264c, 0x260c, 0x2600 }, /* L */
{ 0x273b, 0x273a, none, none }, /* ;: */
{ 0x2827, 0x2822, none, none }, /* '" */
{ 0x2960, 0x297e, none, none }, /* `~ */
{ none, none, none, none }, /* L shift */
{ 0x2b5c, 0x2b7c, 0x2b1c, none }, /* |\ */
{ 0x2c7a, 0x2c5a, 0x2c1a, 0x2c00 }, /* Z */
{ 0x2d78, 0x2d58, 0x2d18, 0x2d00 }, /* X */
{ 0x2e63, 0x2e43, 0x2e03, 0x2e00 }, /* C */
{ 0x2f76, 0x2f56, 0x2f16, 0x2f00 }, /* V */
{ 0x3062, 0x3042, 0x3002, 0x3000 }, /* B */
{ 0x316e, 0x314e, 0x310e, 0x3100 }, /* N */
{ 0x326d, 0x324d, 0x320d, 0x3200 }, /* M */
{ 0x332c, 0x333c, none, none }, /* ,< */
{ 0x342e, 0x343e, none, none }, /* .> */
{ 0x352f, 0x353f, none, none }, /* /? */
{ none, none, none, none }, /* R Shift */
{ 0x372a, 0x372a, none, none }, /* * */
{ none, none, none, none }, /* L Alt */
{ 0x3920, 0x3920, 0x3920, 0x3920 }, /* space */
{ none, none, none, none }, /* caps lock */
{ 0x3b00, 0x5400, 0x5e00, 0x6800 }, /* F1 */
{ 0x3c00, 0x5500, 0x5f00, 0x6900 }, /* F2 */
{ 0x3d00, 0x5600, 0x6000, 0x6a00 }, /* F3 */
{ 0x3e00, 0x5700, 0x6100, 0x6b00 }, /* F4 */
{ 0x3f00, 0x5800, 0x6200, 0x6c00 }, /* F5 */
{ 0x4000, 0x5900, 0x6300, 0x6d00 }, /* F6 */
{ 0x4100, 0x5a00, 0x6400, 0x6e00 }, /* F7 */
{ 0x4200, 0x5b00, 0x6500, 0x6f00 }, /* F8 */
{ 0x4300, 0x5c00, 0x6600, 0x7000 }, /* F9 */
{ 0x4400, 0x5d00, 0x6700, 0x7100 }, /* F10 */
{ none, none, none, none }, /* Num Lock */
{ none, none, none, none }, /* Scroll Lock */
{ 0x4700, 0x4737, 0x7700, none }, /* 7 Home */
{ 0x4800, 0x4838, none, none }, /* 8 UP */
{ 0x4900, 0x4939, 0x8400, none }, /* 9 PgUp */
{ 0x4a2d, 0x4a2d, none, none }, /* - */
{ 0x4b00, 0x4b34, 0x7300, none }, /* 4 Left */
{ 0x4c00, 0x4c35, none, none }, /* 5 */
{ 0x4d00, 0x4d36, 0x7400, none }, /* 6 Right */
{ 0x4e2b, 0x4e2b, none, none }, /* + */
{ 0x4f00, 0x4f31, 0x7500, none }, /* 1 End */
{ 0x5000, 0x5032, none, none }, /* 2 Down */
{ 0x5100, 0x5133, 0x7600, none }, /* 3 PgDn */
{ 0x5200, 0x5230, none, none }, /* 0 Ins */
{ 0x5300, 0x532e, none, none } /* Del */
lettermail2 2003-08-09
  • 打赏
  • 举报
回复
不好意,我发错了,

但是现在W的值是0x1157 与0x57 有点像
#define PLAY1UP 0x1157
Swifter 2003-08-09
  • 打赏
  • 举报
回复
W 对应 0x57
你要想查其他键的虚拟码可以在MSDN里找.
给你贴一点吧


Platform SDK: Windows User Interface
Virtual-Key Codes
The following table shows the symbolic constant names, hexadecimal values, and mouse or keyboard equivalents for the virtual-key codes used by the system. The codes are listed in numeric order.

Symbolic constant name Value
(hexadecimal) Mouse or keyboard equivalent
VK_LBUTTON 01 Left mouse button
VK_RBUTTON 02 Right mouse button
VK_CANCEL 03 Control-break processing
VK_MBUTTON 04 Middle mouse button (three-button mouse)
VK_XBUTTON1 05 Windows 2000/XP: X1 mouse button
VK_XBUTTON2 06 Windows 2000/XP: X2 mouse button
— 07 Undefined
VK_BACK 08 BACKSPACE key
VK_TAB 09 TAB key
— 0A–0B Reserved
VK_CLEAR 0C CLEAR key
VK_RETURN 0D ENTER key
— 0E–0F Undefined
VK_SHIFT 10 SHIFT key
VK_CONTROL 11 CTRL key
VK_MENU 12 ALT key
VK_PAUSE 13 PAUSE key
VK_CAPITAL 14 CAPS LOCK key
VK_KANA 15 IME Kana mode
VK_HANGUEL 15 IME Hanguel mode (maintained for compatibility; use VK_HANGUL)
VK_HANGUL 15 IME Hangul mode
— 16 Undefined
VK_JUNJA 17 IME Junja mode
VK_FINAL 18 IME final mode
VK_HANJA 19 IME Hanja mode
VK_KANJI 19 IME Kanji mode
— 1A Undefined
VK_ESCAPE 1B ESC key
VK_CONVERT 1C IME convert
VK_NONCONVERT 1D IME nonconvert
VK_ACCEPT 1E IME accept
VK_MODECHANGE 1F IME mode change request
VK_SPACE 20 SPACEBAR
VK_PRIOR 21 PAGE UP key
VK_NEXT 22 PAGE DOWN key
VK_END 23 END key
VK_HOME 24 HOME key
VK_LEFT 25 LEFT ARROW key
VK_UP 26 UP ARROW key
VK_RIGHT 27 RIGHT ARROW key
VK_DOWN 28 DOWN ARROW key
VK_SELECT 29 SELECT key
VK_PRINT 2A PRINT key
VK_EXECUTE 2B EXECUTE key
VK_SNAPSHOT 2C PRINT SCREEN key
VK_INSERT 2D INS key
VK_DELETE 2E DEL key
VK_HELP 2F HELP key
30 0 key
31 1 key
32 2 key
33 3 key
34 4 key
35 5 key
36 6 key
37 7 key
38 8 key
39 9 key
— 3A–40 Undefined
41 A key
42 B key
43 C key
44 D key
45 E key
46 F key
47 G key
48 H key
49 I key
4A J key
4B K key
4C L key
4D M key
4E N key
4F O key
50 P key
51 Q key
52 R key
53 S key
54 T key
55 U key
56 V key
57 W key
58 X key
59 Y key
5A Z key
VK_LWIN 5B Left Windows key (Microsoft® Natural® keyboard)
VK_RWIN 5C Right Windows key (Natural keyboard)
VK_APPS 5D Applications key (Natural keyboard)
— 5E Reserved
VK_SLEEP 5F Computer Sleep key
VK_NUMPAD0 60 Numeric keypad 0 key
VK_NUMPAD1 61 Numeric keypad 1 key
VK_NUMPAD2 62 Numeric keypad 2 key
VK_NUMPAD3 63 Numeric keypad 3 key
VK_NUMPAD4 64 Numeric keypad 4 key
VK_NUMPAD5 65 Numeric keypad 5 key
VK_NUMPAD6 66 Numeric keypad 6 key
VK_NUMPAD7 67 Numeric keypad 7 key
VK_NUMPAD8 68 Numeric keypad 8 key
VK_NUMPAD9 69 Numeric keypad 9 key
VK_MULTIPLY 6A Multiply key
VK_ADD 6B Add key
VK_SEPARATOR 6C Separator key
VK_SUBTRACT 6D Subtract key
VK_DECIMAL 6E Decimal key
VK_DIVIDE 6F Divide key
VK_F1 70 F1 key
VK_F2 71 F2 key
VK_F3 72 F3 key
VK_F4 73 F4 key
VK_F5 74 F5 key
VK_F6 75 F6 key
VK_F7 76 F7 key
VK_F8 77 F8 key
VK_F9 78 F9 key
VK_F10 79 F10 key
VK_F11 7A F11 key
VK_F12 7B F12 key
VK_F13 7C F13 key
VK_F14 7D F14 key
VK_F15 7E F15 key
VK_F16 7F F16 key
VK_F17 80H F17 key
VK_F18 81H F18 key
VK_F19 82H F19 key
VK_F20 83H F20 key
VK_F21 84H F21 key
VK_F22 85H F22 key
VK_F23 86H F23 key
VK_F24 87H F24 key
— 88–8F Unassigned
VK_NUMLOCK 90 NUM LOCK key
VK_SCROLL 91 SCROLL LOCK key
92–96 OEM specific
— 97–9F Unassigned
VK_LSHIFT A0 Left SHIFT key
VK_RSHIFT A1 Right SHIFT key
VK_LCONTROL A2 Left CONTROL key
VK_RCONTROL A3 Right CONTROL key
VK_LMENU A4 Left MENU key
VK_RMENU A5 Right MENU key
VK_BROWSER_BACK A6 Windows 2000/XP: Browser Back key
VK_BROWSER_FORWARD A7 Windows 2000/XP: Browser Forward key
VK_BROWSER_REFRESH A8 Windows 2000/XP: Browser Refresh key
VK_BROWSER_STOP A9 Windows 2000/XP: Browser Stop key
VK_BROWSER_SEARCH AA Windows 2000/XP: Browser Search key
VK_BROWSER_FAVORITES AB Windows 2000/XP: Browser Favorites key
VK_BROWSER_HOME AC Windows 2000/XP: Browser Start and Home key
VK_VOLUME_MUTE AD Windows 2000/XP: Volume Mute key
VK_VOLUME_DOWN AE Windows 2000/XP: Volume Down key
VK_VOLUME_UP AF Windows 2000/XP: Volume Up key
VK_MEDIA_NEXT_TRACK B0 Windows 2000/XP: Next Track key
VK_MEDIA_PREV_TRACK B1 Windows 2000/XP: Previous Track key
VK_MEDIA_STOP B2 Windows 2000/XP: Stop Media key
VK_MEDIA_PLAY_PAUSE B3 Windows 2000/XP: Play/Pause Media key
VK_LAUNCH_MAIL B4 Windows 2000/XP: Start Mail key
VK_LAUNCH_MEDIA_SELECT B5 Windows 2000/XP: Select Media key
VK_LAUNCH_APP1 B6 Windows 2000/XP: Start Application 1 key
VK_LAUNCH_APP2 B7 Windows 2000/XP: Start Application 2 key
— B8-B9 Reserved
VK_OEM_1 BA Used for miscellaneous characters; it can vary by keyboard.
Windows 2000/XP: For the US standard keyboard, the ';:' key

VK_OEM_PLUS BB Windows 2000/XP: For any country/region, the '+' key
VK_OEM_COMMA BC Windows 2000/XP: For any country/region, the ',' key
VK_OEM_MINUS BD Windows 2000/XP: For any country/region, the '-' key
VK_OEM_PERIOD BE Windows 2000/XP: For any country/region, the '.' key
VK_OEM_2 BF Used for miscellaneous characters; it can vary by keyboard.
Windows 2000/XP: For the US standard keyboard, the '/?' key

VK_OEM_3 C0 Used for miscellaneous characters; it can vary by keyboard.
Windows 2000/XP: For the US standard keyboard, the '`~' key

— C1–D7 Reserved
— D8–DA Unassigned
VK_OEM_4 DB Used for miscellaneous characters; it can vary by keyboard.
Windows 2000/XP: For the US standard keyboard, the '[{' key

VK_OEM_5 DC Used for miscellaneous characters; it can vary by keyboard.
Windows 2000/XP: For the US standard keyboard, the '\|' key

VK_OEM_6 DD Used for miscellaneous characters; it can vary by keyboard.
Windows 2000/XP: For the US standard keyboard, the ']}' key

VK_OEM_7 DE Used for miscellaneous characters; it can vary by keyboard.
Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key

VK_OEM_8 DF Used for miscellaneous characters; it can vary by keyboard.
— E0 Reserved
E1 OEM specific
VK_OEM_102 E2 Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard
E3–E4 OEM specific
VK_PROCESSKEY E5 Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key
E6 OEM specific
VK_PACKET E7 Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT, SendInput, WM_KEYDOWN, and WM_KEYUP
— E8 Unassigned
E9–F5 OEM specific
VK_ATTN F6 Attn key
VK_CRSEL F7 CrSel key
VK_EXSEL F8 ExSel key
VK_EREOF F9 Erase EOF key
VK_PLAY FA Play key
VK_ZOOM FB Zoom key
VK_NONAME FC Reserved for future use
VK_PA1 FD PA1 key
VK_OEM_CLEAR FE Clear key



Platform SDK Release: August 2001 What did you think of this topic?
Let us know. Order a Platform SDK CD Online
(U.S/Canada) (International)


lettermail2 2003-08-09
  • 打赏
  • 举报
回复
不是, 这是个五子棋的程序,因为它大小写都可以用的,真不明白是怎样来的?

你只要google下“ 0x57 w 键值“ 就会看到它的源程序的。
下面是这个程序的开头部分
#include <stdio.h>
#include <bios.h>
#include <ctype.h>
#include <conio.h>
#include <dos.h>

/**********************************************************/
/* 定义符号常量 */

/*定义画棋盘所需的制表符*/
#define CROSSRU 0xbf /*右上角点*/
#define CROSSLU 0xda /*左上角点*/
#define CROSSLD 0xc0 /*左下角点*/
#define CROSSRD 0xd9 /*右下角点*/
#define CROSSL 0xc3 /*左边*/
#define CROSSR 0xb4 /*右边*/
#define CROSSU 0xc2 /*上边*/
#define CROSSD 0xc1 /*下边*/
#define CROSS 0xc5 /*十字交叉点*/

/*定义棋盘左上角点在屏幕上的位置*/
#define MAPX 5
#define MAPY 2

/*定义1号玩家的操作键键码*/
#define PLAY1UP 0x1157/*上移--'W'*/
#define PLAY1DOWN 0x1f53/*下移--'S'*/
#define PLAY1LEFT 0x1e41/*左移--'A'*/
#define PLAY1RIGHT 0x2044/*右移--'D'*/
#define PLAY1DO 0x2920/*落子--空格键*/

/*定义2号玩家的操作键键码*/
#define PLAY2UP 0x4800/*上移--方向键up*/
#define PLAY2DOWN 0x5000/*下移--方向键down*/
#define PLAY2LEFT 0x4b00/*左移--方向键left*/
#define PLAY2RIGHT 0x4d00/*右移--方向键right*/
#define PLAY2DO 0x1c0d/*落子--回车键Enter*/

AkiraChing 2003-08-09
  • 打赏
  • 举报
回复
‘W’键的Virtual key代码是0x57,Ctrl键的代码是0x11,不知道0x1157是不是Ctrl+W呢,

16,473

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧