Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

181 lines
8.9 KiB

  1. /* File: \shared\emulator\keydef.h (Created: 12/19/95)
  2. *
  3. * Copyright 1995 by Hilgraeve Inc. -- Monroe, MI
  4. * All rights reserved
  5. *
  6. * Description:
  7. * This header file defines structures and macros for
  8. * handling keyboard imput in a plateform independent
  9. * fashion.
  10. *
  11. * $Revision: 1 $
  12. * $Date: 10/05/98 12:27p $
  13. */
  14. #if !defined(KEYDEF_INCLUDED)
  15. #define KEYDEF_INCLUDED
  16. // Here it is! The fame and fabled KEYDEF typedef. This type is used
  17. // throughout our entire code base to represent a "key". A key is any
  18. // character data coming from the user thru a local input device (fancy
  19. // way of saying a keyboard). It contains reserved areas as follows:
  20. //
  21. // bits 00-15 : character or virtual key code.
  22. // bits 16-19 : key state information (ALT, CTRL, SHIFT, EXTENDED)
  23. // bit 23 : controls how bits 00-15 are interpreted (Virtual or char)
  24. //
  25. // This means a KEYDEF has a minimum size of 24 bits. In practical terms
  26. // KEYDEF should be defined in such way to be at least 32 bits.
  27. //
  28. // Interesting thought: There is a world standard being proposed that
  29. // use 32 bits to represent a character. If this ever happens, we would
  30. // have to have a 40 bit value to represent a key. I suspect that when
  31. // that happens, we'll all be using 64 bit architectures anyways.
  32. //
  33. // Interesting thought two: We tried to represent a key as a bit-field
  34. // structure but ran into difficulties. The disadvantages were; needed
  35. // a function to compare KEYDEF values since bit-fields are set in a
  36. // plateform specific way; could not easily create constant KEYDEF values
  37. // that could be used in switch statements. Using a simply integer type
  38. // makes manipulating and comparing KEYDEF values much easier.
  39. //
  40. typedef unsigned int KEYDEF; // minimum size is 32 bits.
  41. // Keys are interpreted as follows:
  42. //
  43. // If the VIRTUAL_KEY flag is clear, then the lower word of the value is the
  44. // displayable (usually ASCII) code for the character
  45. //
  46. // If the VIRTUAL_KEY flag is set, then the lower word is the
  47. // HVK key code for the key that was pressed. In addition, the flags
  48. // for ALT_KEY, CTRL_KEY, SHIFT_KEY, and EXTENDED_KEY are set to the
  49. // correct values.
  50. //
  51. // mrw:3/4/96 - Added the HVIRTUAL_KEY flag. Needed to do this for
  52. // windows because many of the WM_KEYDOWN sequences in Windows look
  53. // like our HVK_? values. The VIRTUAL_KEY flag is stilled OR'ed in
  54. // to the HVK_? values to maintain compatibility with our old code.
  55. //
  56. #define HVIRTUAL_KEY 0x01000000
  57. #define VIRTUAL_KEY 0x00800000
  58. #define ALT_KEY 0x00010000
  59. #define CTRL_KEY 0x00020000
  60. #define SHIFT_KEY 0x00040000
  61. #define EXTENDED_KEY 0x00080000
  62. // So just what is an HVK key code? Virtual keys are representations
  63. // for keys that are independent of the position on the keyboard. For
  64. // instance, our program deals with the concept of Page-Up. We don't
  65. // really care that it is one code in OS/2 and another code in Windows.
  66. // Both OS/2 and Windows generate Virtual key codes but they are
  67. // values (and sometimes symbolic names). To keep our code independent
  68. // of these differences, we translate the system specific virtual key
  69. // code to a HVK key code. Our code then deals only in HVK virtual key
  70. // codes. There of course must be function to provide a translation
  71. // layer which is always defined on the project side.
  72. //
  73. // HVK constants are our definitions for virtual keys. They are plateform
  74. // independent. Anyone translating keyboard input will need a function to
  75. // map the system specific virtual key code to a HVK key code.
  76. //
  77. #define HVK_BUTTON1 (0x01 | VIRTUAL_KEY | HVIRTUAL_KEY)
  78. #define HVK_BUTTON2 (0x02 | VIRTUAL_KEY | HVIRTUAL_KEY)
  79. #define HVK_BUTTON3 (0x03 | VIRTUAL_KEY | HVIRTUAL_KEY)
  80. #define HVK_BREAK (0x04 | VIRTUAL_KEY | HVIRTUAL_KEY)
  81. #define HVK_BACKSPACE (0x05 | VIRTUAL_KEY | HVIRTUAL_KEY) // can't be used in shared code - mrw
  82. #define HVK_TAB (0x06 | VIRTUAL_KEY | HVIRTUAL_KEY)
  83. #define HVK_BACKTAB (0x07 | VIRTUAL_KEY | HVIRTUAL_KEY) // can't be used in shared code - mrw
  84. #define HVK_NEWLINE (0x08 | VIRTUAL_KEY | HVIRTUAL_KEY) // can't be used in shared code - mrw
  85. #define HVK_SHIFT (0x09 | VIRTUAL_KEY | HVIRTUAL_KEY)
  86. #define HVK_CTRL (0x0A | VIRTUAL_KEY | HVIRTUAL_KEY)
  87. #define HVK_ALT (0x0B | VIRTUAL_KEY | HVIRTUAL_KEY)
  88. #define HVK_ALTGRAF (0x0C | VIRTUAL_KEY | HVIRTUAL_KEY) // can't be used in shared code - mrw
  89. #define HVK_PAUSE (0x0D | VIRTUAL_KEY | HVIRTUAL_KEY)
  90. #define HVK_CAPSLOCK (0x0E | VIRTUAL_KEY | HVIRTUAL_KEY)
  91. #define HVK_ESC (0x0F | VIRTUAL_KEY | HVIRTUAL_KEY)
  92. #define HVK_SPACE (0x10 | VIRTUAL_KEY | HVIRTUAL_KEY)
  93. #define HVK_PAGEUP (0x11 | VIRTUAL_KEY | HVIRTUAL_KEY)
  94. #define HVK_PAGEDOWN (0x12 | VIRTUAL_KEY | HVIRTUAL_KEY)
  95. #define HVK_END (0x13 | VIRTUAL_KEY | HVIRTUAL_KEY)
  96. #define HVK_HOME (VK_HOME | VIRTUAL_KEY)
  97. #define HVK_LEFT (VK_LEFT | VIRTUAL_KEY)
  98. #define HVK_UP (VK_UP | VIRTUAL_KEY)
  99. #if FALSE
  100. #define HVK_HOME (0x14 | VIRTUAL_KEY | HVIRTUAL_KEY)
  101. #define HVK_LEFT (0x15 | VIRTUAL_KEY | HVIRTUAL_KEY)
  102. #define HVK_UP (0x16 | VIRTUAL_KEY | HVIRTUAL_KEY)
  103. #endif
  104. #define HVK_RIGHT (0x17 | VIRTUAL_KEY | HVIRTUAL_KEY)
  105. #define HVK_DOWN (0x18 | VIRTUAL_KEY | HVIRTUAL_KEY)
  106. #define HVK_PRINTSCRN (0x19 | VIRTUAL_KEY | HVIRTUAL_KEY)
  107. #define HVK_INSERT (0x1A | VIRTUAL_KEY | HVIRTUAL_KEY)
  108. #define HVK_DELETE (0x1B | VIRTUAL_KEY | HVIRTUAL_KEY)
  109. #define HVK_SCRLLOCK (0x1C | VIRTUAL_KEY | HVIRTUAL_KEY)
  110. #define HVK_NUMLOCK (0x1D | VIRTUAL_KEY | HVIRTUAL_KEY)
  111. #define HVK_ENTER (0x1E | VIRTUAL_KEY | HVIRTUAL_KEY)
  112. #define HVK_SYSRQ (0x1F | VIRTUAL_KEY | HVIRTUAL_KEY) // can't be used in shared code - mrw
  113. #define HVK_F1 (0x20 | VIRTUAL_KEY | HVIRTUAL_KEY)
  114. #define HVK_F2 (0x21 | VIRTUAL_KEY | HVIRTUAL_KEY)
  115. #define HVK_F3 (0x22 | VIRTUAL_KEY | HVIRTUAL_KEY)
  116. #define HVK_F4 (0x23 | VIRTUAL_KEY | HVIRTUAL_KEY)
  117. #define HVK_F5 (0x24 | VIRTUAL_KEY | HVIRTUAL_KEY)
  118. #define HVK_F6 (VK_F6 | VIRTUAL_KEY)
  119. #define HVK_F7 (VK_F7 | VIRTUAL_KEY)
  120. #define HVK_F8 (VK_F8 | VIRTUAL_KEY)
  121. #define HVK_F9 (VK_F9 | VIRTUAL_KEY)
  122. #if FALSE
  123. #define HVK_F6 (0x25 | VIRTUAL_KEY | HVIRTUAL_KEY)
  124. #define HVK_F7 (0x26 | VIRTUAL_KEY | HVIRTUAL_KEY)
  125. #define HVK_F8 (0x27 | VIRTUAL_KEY | HVIRTUAL_KEY)
  126. #define HVK_F9 (0x28 | VIRTUAL_KEY | HVIRTUAL_KEY)
  127. #endif
  128. #define HVK_F10 (0x29 | VIRTUAL_KEY | HVIRTUAL_KEY)
  129. #define HVK_F11 (0x2A | VIRTUAL_KEY | HVIRTUAL_KEY)
  130. #define HVK_F12 (0x2B | VIRTUAL_KEY | HVIRTUAL_KEY)
  131. #define HVK_F13 (0x2C | VIRTUAL_KEY | HVIRTUAL_KEY)
  132. #define HVK_F14 (0x2D | VIRTUAL_KEY | HVIRTUAL_KEY)
  133. #define HVK_F15 (0x2E | VIRTUAL_KEY | HVIRTUAL_KEY)
  134. #define HVK_F16 (0x2F | VIRTUAL_KEY | HVIRTUAL_KEY)
  135. #define HVK_F17 (0x30 | VIRTUAL_KEY | HVIRTUAL_KEY)
  136. #define HVK_F18 (0x31 | VIRTUAL_KEY | HVIRTUAL_KEY)
  137. #define HVK_F19 (0x32 | VIRTUAL_KEY | HVIRTUAL_KEY)
  138. #define HVK_F20 (0x33 | VIRTUAL_KEY | HVIRTUAL_KEY)
  139. #define HVK_F21 (0x34 | VIRTUAL_KEY | HVIRTUAL_KEY)
  140. #define HVK_F22 (0x35 | VIRTUAL_KEY | HVIRTUAL_KEY)
  141. #define HVK_F23 (0x36 | VIRTUAL_KEY | HVIRTUAL_KEY)
  142. #define HVK_F24 (0x37 | VIRTUAL_KEY | HVIRTUAL_KEY)
  143. #define HVK_ENDDRAG (0x38 | VIRTUAL_KEY | HVIRTUAL_KEY) // can't be used in shared code - mrw
  144. #define HVK_EREOF (0x3A | VIRTUAL_KEY | HVIRTUAL_KEY) // can't be used in shared code - mrw
  145. #define HVK_PA1 (0x3B | VIRTUAL_KEY | HVIRTUAL_KEY)
  146. #define HVK_ADD (0x3D | VIRTUAL_KEY | HVIRTUAL_KEY) // Identifies key on Numeric Keypad only.
  147. #define HVK_SUBTRACT (0x3E | VIRTUAL_KEY | HVIRTUAL_KEY) // Identifies key on Numeric Keypad only.
  148. // These constants represent the keys on the numeric keypad, when
  149. // the Num Lock key is on. Again, when the Num Lock key is On.
  150. //
  151. #define HVK_NUMPAD0 (0x45 | VIRTUAL_KEY | HVIRTUAL_KEY)
  152. #define HVK_NUMPAD1 (0x46 | VIRTUAL_KEY | HVIRTUAL_KEY)
  153. #define HVK_NUMPAD2 (0x47 | VIRTUAL_KEY | HVIRTUAL_KEY)
  154. #define HVK_NUMPAD3 (0x48 | VIRTUAL_KEY | HVIRTUAL_KEY)
  155. #define HVK_NUMPAD4 (0x49 | VIRTUAL_KEY | HVIRTUAL_KEY)
  156. #define HVK_NUMPAD5 (0x64 | VIRTUAL_KEY | HVIRTUAL_KEY)
  157. #define HVK_NUMPAD6 (0x4A | VIRTUAL_KEY | HVIRTUAL_KEY)
  158. #define HVK_NUMPAD7 (0x4B | VIRTUAL_KEY | HVIRTUAL_KEY)
  159. #define HVK_NUMPAD8 (0x4C | VIRTUAL_KEY | HVIRTUAL_KEY)
  160. #define HVK_NUMPAD9 (0x4D | VIRTUAL_KEY | HVIRTUAL_KEY)
  161. #define HVK_NUMPADPERIOD (0x53 | VIRTUAL_KEY | HVIRTUAL_KEY)
  162. // These constants represent some of the keys on the numeric keypad, only.
  163. //
  164. #define HVK_DECIMAL (0x4E | VIRTUAL_KEY | HVIRTUAL_KEY)
  165. #define HVK_RETURN (0x4F | VIRTUAL_KEY | HVIRTUAL_KEY)
  166. #define HVK_FSLASH (0x50 | VIRTUAL_KEY | HVIRTUAL_KEY)
  167. #define HVK_MULTIPLY (0x51 | VIRTUAL_KEY | HVIRTUAL_KEY)
  168. // This constant represents the 5 on the numeric keypad, or the center
  169. // key on the edit pad. If it's from the edit pad, the extended bit
  170. // will be set.
  171. //
  172. #define HVK_CENTER (0x52 | VIRTUAL_KEY | HVIRTUAL_KEY)
  173. #endif