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.

443 lines
16 KiB

11 months ago
  1. using System;
  2. using System.IO;
  3. using System.Runtime.InteropServices;
  4. using System.Text;
  5. namespace Apewer.Internals.Interop
  6. {
  7. internal class Constant
  8. {
  9. /// <summary></summary>
  10. public const byte AC_SRC_OVER = 0;
  11. /// <summary></summary>
  12. public const byte AC_SRC_ALPHA = 1;
  13. /// <summary>从左到右显示。</summary>
  14. public const Int32 AW_HOR_POSITIVE = 0x00000001;
  15. /// <summary>从右到左显示。</summary>
  16. public const Int32 AW_HOR_NEGATIVE = 0x00000002;
  17. /// <summary>从上到下显示。</summary>
  18. public const Int32 AW_VER_POSITIVE = 0x00000004;
  19. /// <summary>从下到上显示。</summary>
  20. public const Int32 AW_VER_NEGATIVE = 0x00000008;
  21. /// <summary>若使用了AW_HIDE标志,则使窗口向内重叠,即收缩窗口;否则使窗口向外扩展,即展开窗口。</summary>
  22. public const Int32 AW_CENTER = 0x00000010;
  23. /// <summary>隐藏窗口,缺省则显示窗口。</summary>
  24. public const Int32 AW_HIDE = 0x00010000;
  25. /// <summary>激活窗口。在使用了AW_HIDE标志后不能使用这个标志。</summary>
  26. public const Int32 AW_ACTIVATE = 0x00020000;
  27. /// <summary>使用滑动类型。缺省则为滚动动画类型。当使用AW_CENTER标志时,这个标志就被忽略。</summary>
  28. public const Int32 AW_SLIDE = 0x00040000;
  29. /// <summary>透明度从高到低。</summary>
  30. public const Int32 AW_BLEND = 0x00080000;
  31. /// <summary></summary>
  32. public const int CS_DROPSHADOW = 0x20000;
  33. /// <summary></summary>
  34. public const int FILE_ATTRIBUTE_NORMAL = 0x80;
  35. /// <summary></summary>
  36. public const uint FILE_FLAG_SEQUENTIAL_SCAN = 0x08000000;
  37. /// <summary></summary>
  38. public const int FILE_MAP_COPY = 1;
  39. /// <summary></summary>
  40. public const int FILE_MAP_WRITE = 2;
  41. /// <summary></summary>
  42. public const int FILE_MAP_READ = 4;
  43. /// <summary></summary>
  44. public const int GCL_STYLE = (-26);
  45. /// <summary></summary>
  46. public const uint GENERIC_READ = 0x80000000;
  47. /// <summary></summary>
  48. public const uint GENERIC_WRITE = 0x40000000;
  49. /// <summary></summary>
  50. public const int GWL_EXSTYLE = -20;
  51. public const uint GGI_MARK_NONEXISTING_GLYPHS = 0x01;
  52. /// <summary></summary>
  53. public const int INVALID_HANDLE_VALUE = -1;
  54. /// <summary></summary>
  55. public const int OPEN_EXISTING = 3;
  56. /// <summary></summary>
  57. public const uint PAGE_READWRITE = 0x04;
  58. /// <summary></summary>
  59. public const int PROCESS_ALL_ACCESS = 0x1F0FFF;
  60. /// <summary></summary>
  61. public const int PROCESS_QUERY_INFORMATION = 0x400;
  62. public const int PROCESS_VM_READ = 0x0010;
  63. public const int PROCESS_VM_WRITE = 0x0020;
  64. /// <summary></summary>
  65. public const int SC_MOVE = 0xF010;
  66. /// <summary>play synchronously (default)</summary>
  67. public const int SND_SYNC = 0x0000;
  68. /// <summary>play asynchronously</summary>
  69. public const int SND_ASYNC = 0x0001;
  70. /// <summary>silence (!default) if sound not found</summary>
  71. public const int SND_NODEFAULT = 0x0002;
  72. /// <summary>pszSound points to a memory file</summary>
  73. public const int SND_MEMORY = 0x0004;
  74. /// <summary>loop the sound until next sndPlaySound</summary>
  75. public const int SND_LOOP = 0x0008;
  76. /// <summary>don’t stop any currently playing sound</summary>
  77. public const int SND_NOSTOP = 0x0010;
  78. /// <summary>Stop Playing Wave</summary>
  79. public const int SND_PURGE = 0x0040;
  80. /// <summary>don’t wait if the driver is busy</summary>
  81. public const int SND_NOWAIT = 0x00002000;
  82. /// <summary>name is a registry alias</summary>
  83. public const int SND_ALIAS = 0x00010000;
  84. /// <summary>alias is a predefined id</summary>
  85. public const int SND_ALIAS_ID = 0x00110000;
  86. /// <summary>name is file name</summary>
  87. public const int SND_FILENAME = 0x00020000;
  88. /// <summary>name is resource name or atom</summary>
  89. public const int SND_RESOURCE = 0x00040004;
  90. /// <summary></summary>
  91. public const int STILL_ALIVE = 0x103;
  92. /// <summary></summary>
  93. public const int SW_HIDE = 0;
  94. /// <summary></summary>
  95. public const int SW_SHOWNORMAL = 1;
  96. /// <summary></summary>
  97. public const int SW_SHOWMINIMIZED = 2;
  98. /// <summary></summary>
  99. public const int SW_SHOWMAXIMIZED = 3;
  100. /// <summary></summary>
  101. public const int SW_MAXIMIZE = 3;
  102. /// <summary></summary>
  103. public const int SW_SHOWNOACTIVATE = 4;
  104. /// <summary></summary>
  105. public const int SW_SHOW = 5;
  106. /// <summary></summary>
  107. public const int SW_MINIMIZE = 6;
  108. /// <summary></summary>
  109. public const int SW_SHOWMINNOACTIVE = 7;
  110. /// <summary></summary>
  111. public const int SW_SHOWNA = 8;
  112. /// <summary></summary>
  113. public const int SW_RESTORE = 9;
  114. /// <summary></summary>
  115. public const int ULW_ALPHA = 2;
  116. /// <summary></summary>
  117. public const int WM_CLOSE = 0x0010;
  118. /// <summary></summary>
  119. public const int WM_KEYDOWN = 0X100;
  120. /// <summary></summary>
  121. public const int WM_KEYUP = 0X101;
  122. /// <summary></summary>
  123. public const int WM_SYSCHAR = 0X106;
  124. /// <summary></summary>
  125. public const int WM_SYSKEYUP = 0X105;
  126. /// <summary></summary>
  127. public const int WM_SYSKEYDOWN = 0X104;
  128. /// <summary></summary>
  129. public const int WM_CHAR = 0X102;
  130. /// <summary></summary>
  131. public const int WS_EX_TRANSPARENT = 0x00000020;
  132. /// <summary></summary>
  133. public const int WS_EX_LAYERED = 0x00080000;
  134. /// <summary></summary>
  135. public const int WS_SYSMENU = 0x00080000;
  136. /// <summary></summary>
  137. public const int WS_MINIMIZEBOX = 0x00020000;
  138. public const int ENUM_CURRENT_SETTINGS = -1;
  139. public const int CDS_UPDATEREGISTRY = 0x01;
  140. public const int CDS_TEST = 0x02;
  141. public const int DISP_CHANGE_SUCCESSFUL = 0;
  142. public const int DISP_CHANGE_RESTART = 1;
  143. public const int DISP_CHANGE_FAILED = -1;
  144. public const int DISP_CHANGE_BADMODE = -2;
  145. public const int DISP_CHANGE_NOTUPDATED = -3;
  146. public const int DISP_CHANGE_BADFLAGS = -4;
  147. public const int DISP_CHANGE_BADPARAM = -5;
  148. public const int DISP_CHANGE_BADDUALVIEW = -6;
  149. public const int DMDO_DEFAULT = 0;
  150. public const int DMDO_90 = 1;
  151. public const int DMDO_180 = 2;
  152. public const int DMDO_270 = 3;
  153. #region 电源。
  154. public const int SE_PRIVILEGE_ENABLED = 0x00000002;
  155. public const int TOKEN_QUERY = 0x00000008;
  156. public const int TOKEN_ADJUST_PRIVILEGES = 0x00000020;
  157. public const string SE_SHUTDOWN_NAME = "SeShutdownPrivilege";
  158. public const int EWX_LOGOFF = 0x00000000;
  159. public const int EWX_SHUTDOWN = 0x00000001;
  160. public const int EWX_REBOOT = 0x00000002;
  161. public const int EWX_FORCE = 0x00000004;
  162. public const int EWX_POWEROFF = 0x00000008;
  163. public const int EWX_FORCEIFHUNG = 0x00000010;
  164. #endregion
  165. #region Windows Hook
  166. /// <summary>
  167. /// Installs a hook procedure that monitors messages generated as a result of an input event in a dialog box, message box, menu, or scroll bar.
  168. /// For more information, see the MessageProc hook procedure.
  169. /// </summary>
  170. public const int WH_MSGFILTER = -1;
  171. /// <summary>
  172. /// Installs a hook procedure that records input messages posted to the system message queue.
  173. /// This hook is useful for recording macros.
  174. /// For more information, see the JournalRecordProc hook procedure.
  175. /// </summary>
  176. public const int WH_JOURNALRECORD = 0;
  177. /// <summary>
  178. /// Installs a hook procedure that posts messages previously recorded by a WH_JOURNALRECORD hook procedure.
  179. /// For more information, see the JournalPlaybackProc hook procedure.
  180. /// </summary>
  181. public const int WH_JOURNALPLAYBACK = 1;
  182. /// <summary>
  183. /// Installs a hook procedure that monitors keystroke messages.
  184. /// For more information, see the KeyboardProc hook procedure.
  185. /// </summary>
  186. public const int WH_KEYBOARD = 2;
  187. /// <summary>
  188. /// Installs a hook procedure that monitors messages posted to a message queue.
  189. /// For more information, see the GetMsgProc hook procedure.
  190. /// </summary>
  191. public const int WH_GETMESSAGE = 3;
  192. /// <summary>
  193. /// Installs a hook procedure that monitors messages before the system sends them to the destination window procedure.
  194. /// For more information, see the CallWndProc hook procedure.
  195. /// </summary>
  196. public const int WH_CALLWNDPROC = 4;
  197. /// <summary>
  198. /// Installs a hook procedure that receives notifications useful to a CBT application.
  199. /// For more information, see the CBTProc hook procedure.
  200. /// </summary>
  201. public const int WH_CBT = 5;
  202. /// <summary>
  203. /// Installs a hook procedure that monitors messages generated as a result of an input event in a dialog box, message box, menu, or scroll bar.
  204. /// The hook procedure monitors these messages for all applications in the same desktop as the calling thread.
  205. /// For more information, see the SysMsgProc hook procedure.
  206. /// </summary>
  207. public const int WH_SYSMSGFILTER = 6;
  208. /// <summary>
  209. /// Installs a hook procedure that monitors mouse messages.
  210. /// For more information, see the MouseProc hook procedure.
  211. /// </summary>
  212. public const int WH_MOUSE = 7;
  213. /// <summary>
  214. /// Installs a hook procedure useful for debugging other hook procedures.
  215. /// For more information, see the DebugProc hook procedure.
  216. /// </summary>
  217. public const int WH_DEBUG = 9;
  218. /// <summary>
  219. /// Installs a hook procedure that receives notifications useful to shell applications.
  220. /// For more information, see the ShellProc hook procedure.
  221. /// </summary>
  222. public const int WH_SHELL = 10;
  223. /// <summary>
  224. /// Installs a hook procedure that will be called when the application's foreground thread is about to become idle.
  225. /// This hook is useful for performing low priority tasks during idle time.
  226. /// For more information, see the ForegroundIdleProc hook procedure.
  227. /// </summary>
  228. public const int WH_FOREGROUNDIDLE = 11;
  229. /// <summary>
  230. /// Installs a hook procedure that monitors messages after they have been processed by the destination window procedure.
  231. /// For more information, see the CallWndRetProc hook procedure.
  232. /// </summary>
  233. public const int WH_CALLWNDPROCRET = 12;
  234. /// <summary>
  235. /// Installs a hook procedure that monitors low-level keyboard input events.
  236. /// For more information, see the LowLevelKeyboardProc hook procedure.
  237. /// </summary>
  238. public const int WH_KEYBOARD_LL = 13;
  239. /// <summary
  240. /// >Installs a hook procedure that monitors low-level mouse input events.
  241. /// For more information, see the LowLevelMouseProc hook procedure.
  242. /// </summary>
  243. public const int WH_MOUSE_LL = 14;
  244. #endregion
  245. #region vbKey 按键事件
  246. public const byte vbKeyLButton = 0x1; // 鼠标左键
  247. public const byte vbKeyRButton = 0x2; // 鼠标右键
  248. public const byte vbKeyCancel = 0x3; // CANCEL 键
  249. public const byte vbKeyMButton = 0x4; // 鼠标中键
  250. public const byte vbKeyBack = 0x8; // BACKSPACE 键
  251. public const byte vbKeyTab = 0x9; // TAB 键
  252. public const byte vbKeyClear = 0xC; // CLEAR 键
  253. public const byte vbKeyReturn = 0xD; // ENTER 键
  254. public const byte vbKeyShift = 0x10; // SHIFT 键
  255. public const byte vbKeyControl = 0x11; // CTRL 键
  256. public const byte vbKeyAlt = 18; // Alt 键 (键码18)
  257. public const byte vbKeyMenu = 0x12; // MENU 键
  258. public const byte vbKeyPause = 0x13; // PAUSE 键
  259. public const byte vbKeyCapital = 0x14; // CAPS LOCK 键
  260. public const byte vbKeyEscape = 0x1B; // ESC 键
  261. public const byte vbKeySpace = 0x20; // SPACEBAR 键
  262. public const byte vbKeyPageUp = 0x21; // PAGE UP 键
  263. public const byte vbKeyEnd = 0x23; // End 键
  264. public const byte vbKeyHome = 0x24; // HOME 键
  265. public const byte vbKeyLeft = 0x25; // LEFT ARROW 键
  266. public const byte vbKeyUp = 0x26; // UP ARROW 键
  267. public const byte vbKeyRight = 0x27; // RIGHT ARROW 键
  268. public const byte vbKeyDown = 0x28; // DOWN ARROW 键
  269. public const byte vbKeySelect = 0x29; // Select 键
  270. public const byte vbKeyPrint = 0x2A; // PRINT SCREEN 键
  271. public const byte vbKeyExecute = 0x2B; // EXECUTE 键
  272. public const byte vbKeySnapshot = 0x2C; // SNAPSHOT 键
  273. public const byte vbKeyDelete = 0x2E; // Delete 键
  274. public const byte vbKeyHelp = 0x2F; // HELP 键
  275. public const byte vbKeyNumlock = 0x90; // NUM LOCK 键
  276. public const byte vbKeyA = 65;
  277. public const byte vbKeyB = 66;
  278. public const byte vbKeyC = 67;
  279. public const byte vbKeyD = 68;
  280. public const byte vbKeyE = 69;
  281. public const byte vbKeyF = 70;
  282. public const byte vbKeyG = 71;
  283. public const byte vbKeyH = 72;
  284. public const byte vbKeyI = 73;
  285. public const byte vbKeyJ = 74;
  286. public const byte vbKeyK = 75;
  287. public const byte vbKeyL = 76;
  288. public const byte vbKeyM = 77;
  289. public const byte vbKeyN = 78;
  290. public const byte vbKeyO = 79;
  291. public const byte vbKeyP = 80;
  292. public const byte vbKeyQ = 81;
  293. public const byte vbKeyR = 82;
  294. public const byte vbKeyS = 83;
  295. public const byte vbKeyT = 84;
  296. public const byte vbKeyU = 85;
  297. public const byte vbKeyV = 86;
  298. public const byte vbKeyW = 87;
  299. public const byte vbKeyX = 88;
  300. public const byte vbKeyY = 89;
  301. public const byte vbKeyZ = 90;
  302. public const byte vbKey0 = 48;
  303. public const byte vbKey1 = 49;
  304. public const byte vbKey2 = 50;
  305. public const byte vbKey3 = 51;
  306. public const byte vbKey4 = 52;
  307. public const byte vbKey5 = 53;
  308. public const byte vbKey6 = 54;
  309. public const byte vbKey7 = 55;
  310. public const byte vbKey8 = 56;
  311. public const byte vbKey9 = 57;
  312. public const byte vbKeyNumpad0 = 0x60;
  313. public const byte vbKeyNumpad1 = 0x61;
  314. public const byte vbKeyNumpad2 = 0x62;
  315. public const byte vbKeyNumpad3 = 0x63;
  316. public const byte vbKeyNumpad4 = 0x64;
  317. public const byte vbKeyNumpad5 = 0x65;
  318. public const byte vbKeyNumpad6 = 0x66;
  319. public const byte vbKeyNumpad7 = 0x67;
  320. public const byte vbKeyNumpad8 = 0x68;
  321. public const byte vbKeyNumpad9 = 0x69;
  322. public const byte vbKeyMultiply = 0x6A; // MULTIPLICATIONSIGN (*)
  323. public const byte vbKeyAdd = 0x6B; // PLUS SIGN (+)
  324. public const byte vbKeySeparator = 0x6C; // ENTER
  325. public const byte vbKeySubtract = 0x6D; // MINUS SIGN (-)
  326. public const byte vbKeyDecimal = 0x6E; // DECIMAL POINT (.)
  327. public const byte vbKeyDivide = 0x6F; // DIVISION SIGN (/)
  328. public const byte vbKeyF1 = 0x70;
  329. public const byte vbKeyF2 = 0x71;
  330. public const byte vbKeyF3 = 0x72;
  331. public const byte vbKeyF4 = 0x73;
  332. public const byte vbKeyF5 = 0x74;
  333. public const byte vbKeyF6 = 0x75;
  334. public const byte vbKeyF7 = 0x76;
  335. public const byte vbKeyF8 = 0x77;
  336. public const byte vbKeyF9 = 0x78;
  337. public const byte vbKeyF10 = 0x79;
  338. public const byte vbKeyF11 = 0x7A;
  339. public const byte vbKeyF12 = 0x7B;
  340. #endregion
  341. }
  342. }