懒人记时 代码仓库
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1799 行
83 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Runtime.InteropServices;
  6. using System.Drawing;
  7. public struct RECT
  8. {
  9. public int Left;
  10. public int Top;
  11. public int Right;
  12. public int Bottom;
  13. }
  14. public enum KeybdEventFlag : int
  15. {
  16. KEYEVENTF_KEYDOWN = 0,
  17. KEYEVENTF_KEYUP = 0x2
  18. }
  19. /// <summary>
  20. /// Specifies a raster-operation code. These codes define how the color data for the
  21. /// source rectangle is to be combined with the color data for the destination
  22. /// rectangle to achieve the final color.
  23. /// </summary>
  24. public enum TernaryRasterOperations : uint
  25. {
  26. /// <summary>dest = source</summary>
  27. SRCCOPY = 0x00CC0020,
  28. /// <summary>dest = source OR dest</summary>
  29. SRCPAINT = 0x00EE0086,
  30. /// <summary>dest = source AND dest</summary>
  31. SRCAND = 0x008800C6,
  32. /// <summary>dest = source XOR dest</summary>
  33. SRCINVERT = 0x00660046,
  34. /// <summary>dest = source AND (NOT dest)</summary>
  35. SRCERASE = 0x00440328,
  36. /// <summary>dest = (NOT source)</summary>
  37. NOTSRCCOPY = 0x00330008,
  38. /// <summary>dest = (NOT src) AND (NOT dest)</summary>
  39. NOTSRCERASE = 0x001100A6,
  40. /// <summary>dest = (source AND pattern)</summary>
  41. MERGECOPY = 0x00C000CA,
  42. /// <summary>dest = (NOT source) OR dest</summary>
  43. MERGEPAINT = 0x00BB0226,
  44. /// <summary>dest = pattern</summary>
  45. PATCOPY = 0x00F00021,
  46. /// <summary>dest = DPSnoo</summary>
  47. PATPAINT = 0x00FB0A09,
  48. /// <summary>dest = pattern XOR dest</summary>
  49. PATINVERT = 0x005A0049,
  50. /// <summary>dest = (NOT dest)</summary>
  51. DSTINVERT = 0x00550009,
  52. /// <summary>dest = BLACK</summary>
  53. BLACKNESS = 0x00000042,
  54. /// <summary>dest = WHITE</summary>
  55. WHITENESS = 0x00FF0062,
  56. /// <summary>
  57. /// Capture window as seen on screen. This includes layered windows
  58. /// such as WPF windows with AllowsTransparency="true"
  59. /// </summary>
  60. CAPTUREBLT = 0x40000000
  61. }
  62. public enum StretchBltMode : int
  63. {
  64. STRETCH_ANDSCANS = 1,
  65. STRETCH_ORSCANS = 2,
  66. STRETCH_DELETESCANS = 3,
  67. STRETCH_HALFTONE = 4,
  68. }
  69. public enum WindowsMessage : int
  70. {
  71. LVM_FIRST = 0x1000,
  72. LVM_GETITEMCOUNT = (LVM_FIRST + 4),
  73. WM_COPY = 0x301,
  74. WM_KEYUP = 0x101,
  75. WM_KEYDOWN = 0x100,
  76. WM_CHAR = 0x102,
  77. WM_COMMAND = 0x111,
  78. WM_SYSKEYDOWN = 0x104,
  79. WM_SYSKEYUP = 0x105,
  80. WM_GETTEXT = 0xd,
  81. WM_SETTEXT = 0xc,
  82. BM_CLICK = 0xF5,
  83. WM_CLOSE = 0x10
  84. }
  85. public enum FileInfoFlags : uint
  86. {
  87. SHGFI_ICON = 0x000000100, // get icon
  88. SHGFI_DISPLAYNAME = 0x000000200, // get display name
  89. SHGFI_TYPENAME = 0x000000400, // get type name
  90. SHGFI_ATTRIBUTES = 0x000000800, // get attributes
  91. SHGFI_ICONLOCATION = 0x000001000, // get icon location
  92. SHGFI_EXETYPE = 0x000002000, // return exe type
  93. SHGFI_SYSICONINDEX = 0x000004000, // get system icon index
  94. SHGFI_LINKOVERLAY = 0x000008000, // put a link overlay on icon
  95. SHGFI_SELECTED = 0x000010000, // show icon in selected state
  96. SHGFI_ATTR_SPECIFIED = 0x000020000, // get only specified attributes
  97. SHGFI_LARGEICON = 0x000000000, // get large icon
  98. SHGFI_SMALLICON = 0x000000001, // get small icon
  99. SHGFI_OPENICON = 0x000000002, // get open icon
  100. SHGFI_SHELLICONSIZE = 0x000000004, // get shell size icon
  101. SHGFI_PIDL = 0x000000008, // pszPath is a pidl
  102. SHGFI_USEFILEATTRIBUTES = 0x000000010, // use passed dwFileAttribute
  103. SHGFI_ADDOVERLAYS = 0x000000020, // apply the appropriate overlays
  104. SHGFI_OVERLAYINDEX = 0x000000040 // Get the index of the overlay
  105. }
  106. /// <summary>
  107. /// Windows Messages
  108. /// Defined in winuser.h from Windows SDK v6.1
  109. /// Documentation pulled from MSDN.
  110. /// </summary>
  111. public enum WM : uint
  112. {
  113. /// <summary>
  114. /// The WM_NULL message performs no operation. An application sends the WM_NULL message if it wants to post a message that the recipient window will ignore.
  115. /// </summary>
  116. NULL = 0x0000,
  117. /// <summary>
  118. /// The WM_CREATE message is sent when an application requests that a window be created by calling the CreateWindowEx or CreateWindow function. (The message is sent before the function returns.) The window procedure of the new window receives this message after the window is created, but before the window becomes visible.
  119. /// </summary>
  120. CREATE = 0x0001,
  121. /// <summary>
  122. /// The WM_DESTROY message is sent when a window is being destroyed. It is sent to the window procedure of the window being destroyed after the window is removed from the screen.
  123. /// This message is sent first to the window being destroyed and then to the child windows (if any) as they are destroyed. During the processing of the message, it can be assumed that all child windows still exist.
  124. /// /// </summary>
  125. DESTROY = 0x0002,
  126. /// <summary>
  127. /// The WM_MOVE message is sent after a window has been moved.
  128. /// </summary>
  129. MOVE = 0x0003,
  130. /// <summary>
  131. /// The WM_SIZE message is sent to a window after its size has changed.
  132. /// </summary>
  133. SIZE = 0x0005,
  134. /// <summary>
  135. /// The WM_ACTIVATE message is sent to both the window being activated and the window being deactivated. If the windows use the same input queue, the message is sent synchronously, first to the window procedure of the top-level window being deactivated, then to the window procedure of the top-level window being activated. If the windows use different input queues, the message is sent asynchronously, so the window is activated immediately.
  136. /// </summary>
  137. ACTIVATE = 0x0006,
  138. /// <summary>
  139. /// The WM_SETFOCUS message is sent to a window after it has gained the keyboard focus.
  140. /// </summary>
  141. SETFOCUS = 0x0007,
  142. /// <summary>
  143. /// The WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard focus.
  144. /// </summary>
  145. KILLFOCUS = 0x0008,
  146. /// <summary>
  147. /// The WM_ENABLE message is sent when an application changes the enabled state of a window. It is sent to the window whose enabled state is changing. This message is sent before the EnableWindow function returns, but after the enabled state (WS_DISABLED style bit) of the window has changed.
  148. /// </summary>
  149. ENABLE = 0x000A,
  150. /// <summary>
  151. /// An application sends the WM_SETREDRAW message to a window to allow changes in that window to be redrawn or to prevent changes in that window from being redrawn.
  152. /// </summary>
  153. SETREDRAW = 0x000B,
  154. /// <summary>
  155. /// An application sends a WM_SETTEXT message to set the text of a window.
  156. /// </summary>
  157. SETTEXT = 0x000C,
  158. /// <summary>
  159. /// An application sends a WM_GETTEXT message to copy the text that corresponds to a window into a buffer provided by the caller.
  160. /// </summary>
  161. GETTEXT = 0x000D,
  162. /// <summary>
  163. /// An application sends a WM_GETTEXTLENGTH message to determine the length, in characters, of the text associated with a window.
  164. /// </summary>
  165. GETTEXTLENGTH = 0x000E,
  166. /// <summary>
  167. /// The WM_PAINT message is sent when the system or another application makes a request to paint a portion of an application's window. The message is sent when the UpdateWindow or RedrawWindow function is called, or by the DispatchMessage function when the application obtains a WM_PAINT message by using the GetMessage or PeekMessage function.
  168. /// </summary>
  169. PAINT = 0x000F,
  170. /// <summary>
  171. /// The WM_CLOSE message is sent as a signal that a window or an application should terminate.
  172. /// </summary>
  173. CLOSE = 0x0010,
  174. /// <summary>
  175. /// The WM_QUERYENDSESSION message is sent when the user chooses to end the session or when an application calls one of the system shutdown functions. If any application returns zero, the session is not ended. The system stops sending WM_QUERYENDSESSION messages as soon as one application returns zero.
  176. /// After processing this message, the system sends the WM_ENDSESSION message with the wParam parameter set to the results of the WM_QUERYENDSESSION message.
  177. /// </summary>
  178. QUERYENDSESSION = 0x0011,
  179. /// <summary>
  180. /// The WM_QUERYOPEN message is sent to an icon when the user requests that the window be restored to its previous size and position.
  181. /// </summary>
  182. QUERYOPEN = 0x0013,
  183. /// <summary>
  184. /// The WM_ENDSESSION message is sent to an application after the system processes the results of the WM_QUERYENDSESSION message. The WM_ENDSESSION message informs the application whether the session is ending.
  185. /// </summary>
  186. ENDSESSION = 0x0016,
  187. /// <summary>
  188. /// The WM_QUIT message indicates a request to terminate an application and is generated when the application calls the PostQuitMessage function. It causes the GetMessage function to return zero.
  189. /// </summary>
  190. QUIT = 0x0012,
  191. /// <summary>
  192. /// The WM_ERASEBKGND message is sent when the window background must be erased (for example, when a window is resized). The message is sent to prepare an invalidated portion of a window for painting.
  193. /// </summary>
  194. ERASEBKGND = 0x0014,
  195. /// <summary>
  196. /// This message is sent to all top-level windows when a change is made to a system color setting.
  197. /// </summary>
  198. SYSCOLORCHANGE = 0x0015,
  199. /// <summary>
  200. /// The WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown.
  201. /// </summary>
  202. SHOWWINDOW = 0x0018,
  203. /// <summary>
  204. /// An application sends the WM_WININICHANGE message to all top-level windows after making a change to the WIN.INI file. The SystemParametersInfo function sends this message after an application uses the function to change a setting in WIN.INI.
  205. /// Note The WM_WININICHANGE message is provided only for compatibility with earlier versions of the system. Applications should use the WM_SETTINGCHANGE message.
  206. /// </summary>
  207. WININICHANGE = 0x001A,
  208. /// <summary>
  209. /// An application sends the WM_WININICHANGE message to all top-level windows after making a change to the WIN.INI file. The SystemParametersInfo function sends this message after an application uses the function to change a setting in WIN.INI.
  210. /// Note The WM_WININICHANGE message is provided only for compatibility with earlier versions of the system. Applications should use the WM_SETTINGCHANGE message.
  211. /// </summary>
  212. SETTINGCHANGE = WININICHANGE,
  213. /// <summary>
  214. /// The WM_DEVMODECHANGE message is sent to all top-level windows whenever the user changes device-mode settings.
  215. /// </summary>
  216. DEVMODECHANGE = 0x001B,
  217. /// <summary>
  218. /// The WM_ACTIVATEAPP message is sent when a window belonging to a different application than the active window is about to be activated. The message is sent to the application whose window is being activated and to the application whose window is being deactivated.
  219. /// </summary>
  220. ACTIVATEAPP = 0x001C,
  221. /// <summary>
  222. /// An application sends the WM_FONTCHANGE message to all top-level windows in the system after changing the pool of font resources.
  223. /// </summary>
  224. FONTCHANGE = 0x001D,
  225. /// <summary>
  226. /// A message that is sent whenever there is a change in the system time.
  227. /// </summary>
  228. TIMECHANGE = 0x001E,
  229. /// <summary>
  230. /// The WM_CANCELMODE message is sent to cancel certain modes, such as mouse capture. For example, the system sends this message to the active window when a dialog box or message box is displayed. Certain functions also send this message explicitly to the specified window regardless of whether it is the active window. For example, the EnableWindow function sends this message when disabling the specified window.
  231. /// </summary>
  232. CANCELMODE = 0x001F,
  233. /// <summary>
  234. /// The WM_SETCURSOR message is sent to a window if the mouse causes the cursor to move within a window and mouse input is not captured.
  235. /// </summary>
  236. SETCURSOR = 0x0020,
  237. /// <summary>
  238. /// The WM_MOUSEACTIVATE message is sent when the cursor is in an inactive window and the user presses a mouse button. The parent window receives this message only if the child window passes it to the DefWindowProc function.
  239. /// </summary>
  240. MOUSEACTIVATE = 0x0021,
  241. /// <summary>
  242. /// The WM_CHILDACTIVATE message is sent to a child window when the user clicks the window's title bar or when the window is activated, moved, or sized.
  243. /// </summary>
  244. CHILDACTIVATE = 0x0022,
  245. /// <summary>
  246. /// The WM_QUEUESYNC message is sent by a computer-based training (CBT) application to separate user-input messages from other messages sent through the WH_JOURNALPLAYBACK Hook procedure.
  247. /// </summary>
  248. QUEUESYNC = 0x0023,
  249. /// <summary>
  250. /// The WM_GETMINMAXINFO message is sent to a window when the size or position of the window is about to change. An application can use this message to override the window's default maximized size and position, or its default minimum or maximum tracking size.
  251. /// </summary>
  252. GETMINMAXINFO = 0x0024,
  253. /// <summary>
  254. /// Windows NT 3.51 and earlier: The WM_PAINTICON message is sent to a minimized window when the icon is to be painted. This message is not sent by newer versions of Microsoft Windows, except in unusual circumstances explained in the Remarks.
  255. /// </summary>
  256. PAINTICON = 0x0026,
  257. /// <summary>
  258. /// Windows NT 3.51 and earlier: The WM_ICONERASEBKGND message is sent to a minimized window when the background of the icon must be filled before painting the icon. A window receives this message only if a class icon is defined for the window; otherwise, WM_ERASEBKGND is sent. This message is not sent by newer versions of Windows.
  259. /// </summary>
  260. ICONERASEBKGND = 0x0027,
  261. /// <summary>
  262. /// The WM_NEXTDLGCTL message is sent to a dialog box procedure to set the keyboard focus to a different control in the dialog box.
  263. /// </summary>
  264. NEXTDLGCTL = 0x0028,
  265. /// <summary>
  266. /// The WM_SPOOLERSTATUS message is sent from Print Manager whenever a job is added to or removed from the Print Manager queue.
  267. /// </summary>
  268. SPOOLERSTATUS = 0x002A,
  269. /// <summary>
  270. /// The WM_DRAWITEM message is sent to the parent window of an owner-drawn button, combo box, list box, or menu when a visual aspect of the button, combo box, list box, or menu has changed.
  271. /// </summary>
  272. DRAWITEM = 0x002B,
  273. /// <summary>
  274. /// The WM_MEASUREITEM message is sent to the owner window of a combo box, list box, list view control, or menu item when the control or menu is created.
  275. /// </summary>
  276. MEASUREITEM = 0x002C,
  277. /// <summary>
  278. /// Sent to the owner of a list box or combo box when the list box or combo box is destroyed or when items are removed by the LB_DELETESTRING, LB_RESETCONTENT, CB_DELETESTRING, or CB_RESETCONTENT message. The system sends a WM_DELETEITEM message for each deleted item. The system sends the WM_DELETEITEM message for any deleted list box or combo box item with nonzero item data.
  279. /// </summary>
  280. DELETEITEM = 0x002D,
  281. /// <summary>
  282. /// Sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_KEYDOWN message.
  283. /// </summary>
  284. VKEYTOITEM = 0x002E,
  285. /// <summary>
  286. /// Sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_CHAR message.
  287. /// </summary>
  288. CHARTOITEM = 0x002F,
  289. /// <summary>
  290. /// An application sends a WM_SETFONT message to specify the font that a control is to use when drawing text.
  291. /// </summary>
  292. SETFONT = 0x0030,
  293. /// <summary>
  294. /// An application sends a WM_GETFONT message to a control to retrieve the font with which the control is currently drawing its text.
  295. /// </summary>
  296. GETFONT = 0x0031,
  297. /// <summary>
  298. /// An application sends a WM_SETHOTKEY message to a window to associate a hot key with the window. When the user presses the hot key, the system activates the window.
  299. /// </summary>
  300. SETHOTKEY = 0x0032,
  301. /// <summary>
  302. /// An application sends a WM_GETHOTKEY message to determine the hot key associated with a window.
  303. /// </summary>
  304. GETHOTKEY = 0x0033,
  305. /// <summary>
  306. /// The WM_QUERYDRAGICON message is sent to a minimized (iconic) window. The window is about to be dragged by the user but does not have an icon defined for its class. An application can return a handle to an icon or cursor. The system displays this cursor or icon while the user drags the icon.
  307. /// </summary>
  308. QUERYDRAGICON = 0x0037,
  309. /// <summary>
  310. /// The system sends the WM_COMPAREITEM message to determine the relative position of a new item in the sorted list of an owner-drawn combo box or list box. Whenever the application adds a new item, the system sends this message to the owner of a combo box or list box created with the CBS_SORT or LBS_SORT style.
  311. /// </summary>
  312. COMPAREITEM = 0x0039,
  313. /// <summary>
  314. /// Active Accessibility sends the WM_GETOBJECT message to obtain information about an accessible object contained in a server application.
  315. /// Applications never send this message directly. It is sent only by Active Accessibility in response to calls to AccessibleObjectFromPoint, AccessibleObjectFromEvent, or AccessibleObjectFromWindow. However, server applications handle this message.
  316. /// </summary>
  317. GETOBJECT = 0x003D,
  318. /// <summary>
  319. /// The WM_COMPACTING message is sent to all top-level windows when the system detects more than 12.5 percent of system time over a 30- to 60-second interval is being spent compacting memory. This indicates that system memory is low.
  320. /// </summary>
  321. COMPACTING = 0x0041,
  322. /// <summary>
  323. /// WM_COMMNOTIFY is Obsolete for Win32-Based Applications
  324. /// </summary>
  325. [Obsolete]
  326. COMMNOTIFY = 0x0044,
  327. /// <summary>
  328. /// The WM_WINDOWPOSCHANGING message is sent to a window whose size, position, or place in the Z order is about to change as a result of a call to the SetWindowPos function or another window-management function.
  329. /// </summary>
  330. WINDOWPOSCHANGING = 0x0046,
  331. /// <summary>
  332. /// The WM_WINDOWPOSCHANGED message is sent to a window whose size, position, or place in the Z order has changed as a result of a call to the SetWindowPos function or another window-management function.
  333. /// </summary>
  334. WINDOWPOSCHANGED = 0x0047,
  335. /// <summary>
  336. /// Notifies applications that the system, typically a battery-powered personal computer, is about to enter a suspended mode.
  337. /// Use: POWERBROADCAST
  338. /// </summary>
  339. [Obsolete]
  340. POWER = 0x0048,
  341. /// <summary>
  342. /// An application sends the WM_COPYDATA message to pass data to another application.
  343. /// </summary>
  344. COPYDATA = 0x004A,
  345. /// <summary>
  346. /// The WM_CANCELJOURNAL message is posted to an application when a user cancels the application's journaling activities. The message is posted with a NULL window handle.
  347. /// </summary>
  348. CANCELJOURNAL = 0x004B,
  349. /// <summary>
  350. /// Sent by a common control to its parent window when an event has occurred or the control requires some information.
  351. /// </summary>
  352. NOTIFY = 0x004E,
  353. /// <summary>
  354. /// The WM_INPUTLANGCHANGEREQUEST message is posted to the window with the focus when the user chooses a new input language, either with the hotkey (specified in the Keyboard control panel application) or from the indicator on the system taskbar. An application can accept the change by passing the message to the DefWindowProc function or reject the change (and prevent it from taking place) by returning immediately.
  355. /// </summary>
  356. INPUTLANGCHANGEREQUEST = 0x0050,
  357. /// <summary>
  358. /// The WM_INPUTLANGCHANGE message is sent to the topmost affected window after an application's input language has been changed. You should make any application-specific settings and pass the message to the DefWindowProc function, which passes the message to all first-level child windows. These child windows can pass the message to DefWindowProc to have it pass the message to their child windows, and so on.
  359. /// </summary>
  360. INPUTLANGCHANGE = 0x0051,
  361. /// <summary>
  362. /// Sent to an application that has initiated a training card with Microsoft Windows Help. The message informs the application when the user clicks an authorable button. An application initiates a training card by specifying the HELP_TCARD command in a call to the WinHelp function.
  363. /// </summary>
  364. TCARD = 0x0052,
  365. /// <summary>
  366. /// Indicates that the user pressed the F1 key. If a menu is active when F1 is pressed, WM_HELP is sent to the window associated with the menu; otherwise, WM_HELP is sent to the window that has the keyboard focus. If no window has the keyboard focus, WM_HELP is sent to the currently active window.
  367. /// </summary>
  368. HELP = 0x0053,
  369. /// <summary>
  370. /// The WM_USERCHANGED message is sent to all windows after the user has logged on or off. When the user logs on or off, the system updates the user-specific settings. The system sends this message immediately after updating the settings.
  371. /// </summary>
  372. USERCHANGED = 0x0054,
  373. /// <summary>
  374. /// Determines if a window accepts ANSI or Unicode structures in the WM_NOTIFY notification message. WM_NOTIFYFORMAT messages are sent from a common control to its parent window and from the parent window to the common control.
  375. /// </summary>
  376. NOTIFYFORMAT = 0x0055,
  377. /// <summary>
  378. /// The WM_CONTEXTMENU message notifies a window that the user clicked the right mouse button (right-clicked) in the window.
  379. /// </summary>
  380. CONTEXTMENU = 0x007B,
  381. /// <summary>
  382. /// The WM_STYLECHANGING message is sent to a window when the SetWindowLong function is about to change one or more of the window's styles.
  383. /// </summary>
  384. STYLECHANGING = 0x007C,
  385. /// <summary>
  386. /// The WM_STYLECHANGED message is sent to a window after the SetWindowLong function has changed one or more of the window's styles
  387. /// </summary>
  388. STYLECHANGED = 0x007D,
  389. /// <summary>
  390. /// The WM_DISPLAYCHANGE message is sent to all windows when the display resolution has changed.
  391. /// </summary>
  392. DISPLAYCHANGE = 0x007E,
  393. /// <summary>
  394. /// The WM_GETICON message is sent to a window to retrieve a handle to the large or small icon associated with a window. The system displays the large icon in the ALT+TAB dialog, and the small icon in the window caption.
  395. /// </summary>
  396. GETICON = 0x007F,
  397. /// <summary>
  398. /// An application sends the WM_SETICON message to associate a new large or small icon with a window. The system displays the large icon in the ALT+TAB dialog box, and the small icon in the window caption.
  399. /// </summary>
  400. SETICON = 0x0080,
  401. /// <summary>
  402. /// The WM_NCCREATE message is sent prior to the WM_CREATE message when a window is first created.
  403. /// </summary>
  404. NCCREATE = 0x0081,
  405. /// <summary>
  406. /// The WM_NCDESTROY message informs a window that its nonclient area is being destroyed. The DestroyWindow function sends the WM_NCDESTROY message to the window following the WM_DESTROY message. WM_DESTROY is used to free the allocated memory object associated with the window.
  407. /// The WM_NCDESTROY message is sent after the child windows have been destroyed. In contrast, WM_DESTROY is sent before the child windows are destroyed.
  408. /// </summary>
  409. NCDESTROY = 0x0082,
  410. /// <summary>
  411. /// The WM_NCCALCSIZE message is sent when the size and position of a window's client area must be calculated. By processing this message, an application can control the content of the window's client area when the size or position of the window changes.
  412. /// </summary>
  413. NCCALCSIZE = 0x0083,
  414. /// <summary>
  415. /// The WM_NCHITTEST message is sent to a window when the cursor moves, or when a mouse button is pressed or released. If the mouse is not captured, the message is sent to the window beneath the cursor. Otherwise, the message is sent to the window that has captured the mouse.
  416. /// </summary>
  417. NCHITTEST = 0x0084,
  418. /// <summary>
  419. /// The WM_NCPAINT message is sent to a window when its frame must be painted.
  420. /// </summary>
  421. NCPAINT = 0x0085,
  422. /// <summary>
  423. /// The WM_NCACTIVATE message is sent to a window when its nonclient area needs to be changed to indicate an active or inactive state.
  424. /// </summary>
  425. NCACTIVATE = 0x0086,
  426. /// <summary>
  427. /// The WM_GETDLGCODE message is sent to the window procedure associated with a control. By default, the system handles all keyboard input to the control; the system interprets certain types of keyboard input as dialog box navigation keys. To override this default behavior, the control can respond to the WM_GETDLGCODE message to indicate the types of input it wants to process itself.
  428. /// </summary>
  429. GETDLGCODE = 0x0087,
  430. /// <summary>
  431. /// The WM_SYNCPAINT message is used to synchronize painting while avoiding linking independent GUI threads.
  432. /// </summary>
  433. SYNCPAINT = 0x0088,
  434. /// <summary>
  435. /// The WM_NCMOUSEMOVE message is posted to a window when the cursor is moved within the nonclient area of the window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
  436. /// </summary>
  437. NCMOUSEMOVE = 0x00A0,
  438. /// <summary>
  439. /// The WM_NCLBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
  440. /// </summary>
  441. NCLBUTTONDOWN = 0x00A1,
  442. /// <summary>
  443. /// The WM_NCLBUTTONUP message is posted when the user releases the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
  444. /// </summary>
  445. NCLBUTTONUP = 0x00A2,
  446. /// <summary>
  447. /// The WM_NCLBUTTONDBLCLK message is posted when the user double-clicks the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
  448. /// </summary>
  449. NCLBUTTONDBLCLK = 0x00A3,
  450. /// <summary>
  451. /// The WM_NCRBUTTONDOWN message is posted when the user presses the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
  452. /// </summary>
  453. NCRBUTTONDOWN = 0x00A4,
  454. /// <summary>
  455. /// The WM_NCRBUTTONUP message is posted when the user releases the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
  456. /// </summary>
  457. NCRBUTTONUP = 0x00A5,
  458. /// <summary>
  459. /// The WM_NCRBUTTONDBLCLK message is posted when the user double-clicks the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
  460. /// </summary>
  461. NCRBUTTONDBLCLK = 0x00A6,
  462. /// <summary>
  463. /// The WM_NCMBUTTONDOWN message is posted when the user presses the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
  464. /// </summary>
  465. NCMBUTTONDOWN = 0x00A7,
  466. /// <summary>
  467. /// The WM_NCMBUTTONUP message is posted when the user releases the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
  468. /// </summary>
  469. NCMBUTTONUP = 0x00A8,
  470. /// <summary>
  471. /// The WM_NCMBUTTONDBLCLK message is posted when the user double-clicks the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
  472. /// </summary>
  473. NCMBUTTONDBLCLK = 0x00A9,
  474. /// <summary>
  475. /// The WM_NCXBUTTONDOWN message is posted when the user presses the first or second X button while the cursor is in the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
  476. /// </summary>
  477. NCXBUTTONDOWN = 0x00AB,
  478. /// <summary>
  479. /// The WM_NCXBUTTONUP message is posted when the user releases the first or second X button while the cursor is in the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
  480. /// </summary>
  481. NCXBUTTONUP = 0x00AC,
  482. /// <summary>
  483. /// The WM_NCXBUTTONDBLCLK message is posted when the user double-clicks the first or second X button while the cursor is in the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
  484. /// </summary>
  485. NCXBUTTONDBLCLK = 0x00AD,
  486. /// <summary>
  487. /// The WM_INPUT_DEVICE_CHANGE message is sent to the window that registered to receive raw input. A window receives this message through its WindowProc function.
  488. /// </summary>
  489. INPUT_DEVICE_CHANGE = 0x00FE,
  490. /// <summary>
  491. /// The WM_INPUT message is sent to the window that is getting raw input.
  492. /// </summary>
  493. INPUT = 0x00FF,
  494. /// <summary>
  495. /// This message filters for keyboard messages.
  496. /// </summary>
  497. KEYFIRST = 0x0100,
  498. /// <summary>
  499. /// The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem key is pressed. A nonsystem key is a key that is pressed when the ALT key is not pressed.
  500. /// </summary>
  501. KEYDOWN = 0x0100,
  502. /// <summary>
  503. /// The WM_KEYUP message is posted to the window with the keyboard focus when a nonsystem key is released. A nonsystem key is a key that is pressed when the ALT key is not pressed, or a keyboard key that is pressed when a window has the keyboard focus.
  504. /// </summary>
  505. KEYUP = 0x0101,
  506. /// <summary>
  507. /// The WM_CHAR message is posted to the window with the keyboard focus when a WM_KEYDOWN message is translated by the TranslateMessage function. The WM_CHAR message contains the character code of the key that was pressed.
  508. /// </summary>
  509. CHAR = 0x0102,
  510. /// <summary>
  511. /// The WM_DEADCHAR message is posted to the window with the keyboard focus when a WM_KEYUP message is translated by the TranslateMessage function. WM_DEADCHAR specifies a character code generated by a dead key. A dead key is a key that generates a character, such as the umlaut (double-dot), that is combined with another character to form a composite character. For example, the umlaut-O character (Ö) is generated by typing the dead key for the umlaut character, and then typing the O key.
  512. /// </summary>
  513. DEADCHAR = 0x0103,
  514. /// <summary>
  515. /// The WM_SYSKEYDOWN message is posted to the window with the keyboard focus when the user presses the F10 key (which activates the menu bar) or holds down the ALT key and then presses another key. It also occurs when no window currently has the keyboard focus; in this case, the WM_SYSKEYDOWN message is sent to the active window. The window that receives the message can distinguish between these two contexts by checking the context code in the lParam parameter.
  516. /// </summary>
  517. SYSKEYDOWN = 0x0104,
  518. /// <summary>
  519. /// The WM_SYSKEYUP message is posted to the window with the keyboard focus when the user releases a key that was pressed while the ALT key was held down. It also occurs when no window currently has the keyboard focus; in this case, the WM_SYSKEYUP message is sent to the active window. The window that receives the message can distinguish between these two contexts by checking the context code in the lParam parameter.
  520. /// </summary>
  521. SYSKEYUP = 0x0105,
  522. /// <summary>
  523. /// The WM_SYSCHAR message is posted to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function. It specifies the character code of a system character key — that is, a character key that is pressed while the ALT key is down.
  524. /// </summary>
  525. SYSCHAR = 0x0106,
  526. /// <summary>
  527. /// The WM_SYSDEADCHAR message is sent to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function. WM_SYSDEADCHAR specifies the character code of a system dead key — that is, a dead key that is pressed while holding down the ALT key.
  528. /// </summary>
  529. SYSDEADCHAR = 0x0107,
  530. /// <summary>
  531. /// The WM_UNICHAR message is posted to the window with the keyboard focus when a WM_KEYDOWN message is translated by the TranslateMessage function. The WM_UNICHAR message contains the character code of the key that was pressed.
  532. /// The WM_UNICHAR message is equivalent to WM_CHAR, but it uses Unicode Transformation Format (UTF)-32, whereas WM_CHAR uses UTF-16. It is designed to send or post Unicode characters to ANSI windows and it can can handle Unicode Supplementary Plane characters.
  533. /// </summary>
  534. UNICHAR = 0x0109,
  535. /// <summary>
  536. /// This message filters for keyboard messages.
  537. /// </summary>
  538. KEYLAST = 0x0109,
  539. /// <summary>
  540. /// Sent immediately before the IME generates the composition string as a result of a keystroke. A window receives this message through its WindowProc function.
  541. /// </summary>
  542. IME_STARTCOMPOSITION = 0x010D,
  543. /// <summary>
  544. /// Sent to an application when the IME ends composition. A window receives this message through its WindowProc function.
  545. /// </summary>
  546. IME_ENDCOMPOSITION = 0x010E,
  547. /// <summary>
  548. /// Sent to an application when the IME changes composition status as a result of a keystroke. A window receives this message through its WindowProc function.
  549. /// </summary>
  550. IME_COMPOSITION = 0x010F,
  551. IME_KEYLAST = 0x010F,
  552. /// <summary>
  553. /// The WM_INITDIALOG message is sent to the dialog box procedure immediately before a dialog box is displayed. Dialog box procedures typically use this message to initialize controls and carry out any other initialization tasks that affect the appearance of the dialog box.
  554. /// </summary>
  555. INITDIALOG = 0x0110,
  556. /// <summary>
  557. /// The WM_COMMAND message is sent when the user selects a command item from a menu, when a control sends a notification message to its parent window, or when an accelerator keystroke is translated.
  558. /// </summary>
  559. COMMAND = 0x0111,
  560. /// <summary>
  561. /// A window receives this message when the user chooses a command from the Window menu, clicks the maximize button, minimize button, restore button, close button, or moves the form. You can stop the form from moving by filtering this out.
  562. /// </summary>
  563. SYSCOMMAND = 0x0112,
  564. /// <summary>
  565. /// The WM_TIMER message is posted to the installing thread's message queue when a timer expires. The message is posted by the GetMessage or PeekMessage function.
  566. /// </summary>
  567. TIMER = 0x0113,
  568. /// <summary>
  569. /// The WM_HSCROLL message is sent to a window when a scroll event occurs in the window's standard horizontal scroll bar. This message is also sent to the owner of a horizontal scroll bar control when a scroll event occurs in the control.
  570. /// </summary>
  571. HSCROLL = 0x0114,
  572. /// <summary>
  573. /// The WM_VSCROLL message is sent to a window when a scroll event occurs in the window's standard vertical scroll bar. This message is also sent to the owner of a vertical scroll bar control when a scroll event occurs in the control.
  574. /// </summary>
  575. VSCROLL = 0x0115,
  576. /// <summary>
  577. /// The WM_INITMENU message is sent when a menu is about to become active. It occurs when the user clicks an item on the menu bar or presses a menu key. This allows the application to modify the menu before it is displayed.
  578. /// </summary>
  579. INITMENU = 0x0116,
  580. /// <summary>
  581. /// The WM_INITMENUPOPUP message is sent when a drop-down menu or submenu is about to become active. This allows an application to modify the menu before it is displayed, without changing the entire menu.
  582. /// </summary>
  583. INITMENUPOPUP = 0x0117,
  584. /// <summary>
  585. /// The WM_MENUSELECT message is sent to a menu's owner window when the user selects a menu item.
  586. /// </summary>
  587. MENUSELECT = 0x011F,
  588. /// <summary>
  589. /// The WM_MENUCHAR message is sent when a menu is active and the user presses a key that does not correspond to any mnemonic or accelerator key. This message is sent to the window that owns the menu.
  590. /// </summary>
  591. MENUCHAR = 0x0120,
  592. /// <summary>
  593. /// The WM_ENTERIDLE message is sent to the owner window of a modal dialog box or menu that is entering an idle state. A modal dialog box or menu enters an idle state when no messages are waiting in its queue after it has processed one or more previous messages.
  594. /// </summary>
  595. ENTERIDLE = 0x0121,
  596. /// <summary>
  597. /// The WM_MENURBUTTONUP message is sent when the user releases the right mouse button while the cursor is on a menu item.
  598. /// </summary>
  599. MENURBUTTONUP = 0x0122,
  600. /// <summary>
  601. /// The WM_MENUDRAG message is sent to the owner of a drag-and-drop menu when the user drags a menu item.
  602. /// </summary>
  603. MENUDRAG = 0x0123,
  604. /// <summary>
  605. /// The WM_MENUGETOBJECT message is sent to the owner of a drag-and-drop menu when the mouse cursor enters a menu item or moves from the center of the item to the top or bottom of the item.
  606. /// </summary>
  607. MENUGETOBJECT = 0x0124,
  608. /// <summary>
  609. /// The WM_UNINITMENUPOPUP message is sent when a drop-down menu or submenu has been destroyed.
  610. /// </summary>
  611. UNINITMENUPOPUP = 0x0125,
  612. /// <summary>
  613. /// The WM_MENUCOMMAND message is sent when the user makes a selection from a menu.
  614. /// </summary>
  615. MENUCOMMAND = 0x0126,
  616. /// <summary>
  617. /// An application sends the WM_CHANGEUISTATE message to indicate that the user interface (UI) state should be changed.
  618. /// </summary>
  619. CHANGEUISTATE = 0x0127,
  620. /// <summary>
  621. /// An application sends the WM_UPDATEUISTATE message to change the user interface (UI) state for the specified window and all its child windows.
  622. /// </summary>
  623. UPDATEUISTATE = 0x0128,
  624. /// <summary>
  625. /// An application sends the WM_QUERYUISTATE message to retrieve the user interface (UI) state for a window.
  626. /// </summary>
  627. QUERYUISTATE = 0x0129,
  628. /// <summary>
  629. /// The WM_CTLCOLORMSGBOX message is sent to the owner window of a message box before Windows draws the message box. By responding to this message, the owner window can set the text and background colors of the message box by using the given display device context handle.
  630. /// </summary>
  631. CTLCOLORMSGBOX = 0x0132,
  632. /// <summary>
  633. /// An edit control that is not read-only or disabled sends the WM_CTLCOLOREDIT message to its parent window when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the edit control.
  634. /// </summary>
  635. CTLCOLOREDIT = 0x0133,
  636. /// <summary>
  637. /// Sent to the parent window of a list box before the system draws the list box. By responding to this message, the parent window can set the text and background colors of the list box by using the specified display device context handle.
  638. /// </summary>
  639. CTLCOLORLISTBOX = 0x0134,
  640. /// <summary>
  641. /// The WM_CTLCOLORBTN message is sent to the parent window of a button before drawing the button. The parent window can change the button's text and background colors. However, only owner-drawn buttons respond to the parent window processing this message.
  642. /// </summary>
  643. CTLCOLORBTN = 0x0135,
  644. /// <summary>
  645. /// The WM_CTLCOLORDLG message is sent to a dialog box before the system draws the dialog box. By responding to this message, the dialog box can set its text and background colors using the specified display device context handle.
  646. /// </summary>
  647. CTLCOLORDLG = 0x0136,
  648. /// <summary>
  649. /// The WM_CTLCOLORSCROLLBAR message is sent to the parent window of a scroll bar control when the control is about to be drawn. By responding to this message, the parent window can use the display context handle to set the background color of the scroll bar control.
  650. /// </summary>
  651. CTLCOLORSCROLLBAR = 0x0137,
  652. /// <summary>
  653. /// A static control, or an edit control that is read-only or disabled, sends the WM_CTLCOLORSTATIC message to its parent window when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the static control.
  654. /// </summary>
  655. CTLCOLORSTATIC = 0x0138,
  656. /// <summary>
  657. /// Use WM_MOUSEFIRST to specify the first mouse message. Use the PeekMessage() Function.
  658. /// </summary>
  659. MOUSEFIRST = 0x0200,
  660. /// <summary>
  661. /// The WM_MOUSEMOVE message is posted to a window when the cursor moves. If the mouse is not captured, the message is posted to the window that contains the cursor. Otherwise, the message is posted to the window that has captured the mouse.
  662. /// </summary>
  663. MOUSEMOVE = 0x0200,
  664. /// <summary>
  665. /// The WM_LBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
  666. /// </summary>
  667. LBUTTONDOWN = 0x0201,
  668. /// <summary>
  669. /// The WM_LBUTTONUP message is posted when the user releases the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
  670. /// </summary>
  671. LBUTTONUP = 0x0202,
  672. /// <summary>
  673. /// The WM_LBUTTONDBLCLK message is posted when the user double-clicks the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
  674. /// </summary>
  675. LBUTTONDBLCLK = 0x0203,
  676. /// <summary>
  677. /// The WM_RBUTTONDOWN message is posted when the user presses the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
  678. /// </summary>
  679. RBUTTONDOWN = 0x0204,
  680. /// <summary>
  681. /// The WM_RBUTTONUP message is posted when the user releases the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
  682. /// </summary>
  683. RBUTTONUP = 0x0205,
  684. /// <summary>
  685. /// The WM_RBUTTONDBLCLK message is posted when the user double-clicks the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
  686. /// </summary>
  687. RBUTTONDBLCLK = 0x0206,
  688. /// <summary>
  689. /// The WM_MBUTTONDOWN message is posted when the user presses the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
  690. /// </summary>
  691. MBUTTONDOWN = 0x0207,
  692. /// <summary>
  693. /// The WM_MBUTTONUP message is posted when the user releases the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
  694. /// </summary>
  695. MBUTTONUP = 0x0208,
  696. /// <summary>
  697. /// The WM_MBUTTONDBLCLK message is posted when the user double-clicks the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
  698. /// </summary>
  699. MBUTTONDBLCLK = 0x0209,
  700. /// <summary>
  701. /// The WM_MOUSEWHEEL message is sent to the focus window when the mouse wheel is rotated. The DefWindowProc function propagates the message to the window's parent. There should be no internal forwarding of the message, since DefWindowProc propagates it up the parent chain until it finds a window that processes it.
  702. /// </summary>
  703. MOUSEWHEEL = 0x020A,
  704. /// <summary>
  705. /// The WM_XBUTTONDOWN message is posted when the user presses the first or second X button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
  706. /// </summary>
  707. XBUTTONDOWN = 0x020B,
  708. /// <summary>
  709. /// The WM_XBUTTONUP message is posted when the user releases the first or second X button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
  710. /// </summary>
  711. XBUTTONUP = 0x020C,
  712. /// <summary>
  713. /// The WM_XBUTTONDBLCLK message is posted when the user double-clicks the first or second X button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
  714. /// </summary>
  715. XBUTTONDBLCLK = 0x020D,
  716. /// <summary>
  717. /// The WM_MOUSEHWHEEL message is sent to the focus window when the mouse's horizontal scroll wheel is tilted or rotated. The DefWindowProc function propagates the message to the window's parent. There should be no internal forwarding of the message, since DefWindowProc propagates it up the parent chain until it finds a window that processes it.
  718. /// </summary>
  719. MOUSEHWHEEL = 0x020E,
  720. /// <summary>
  721. /// Use WM_MOUSELAST to specify the last mouse message. Used with PeekMessage() Function.
  722. /// </summary>
  723. MOUSELAST = 0x020E,
  724. /// <summary>
  725. /// The WM_PARENTNOTIFY message is sent to the parent of a child window when the child window is created or destroyed, or when the user clicks a mouse button while the cursor is over the child window. When the child window is being created, the system sends WM_PARENTNOTIFY just before the CreateWindow or CreateWindowEx function that creates the window returns. When the child window is being destroyed, the system sends the message before any processing to destroy the window takes place.
  726. /// </summary>
  727. PARENTNOTIFY = 0x0210,
  728. /// <summary>
  729. /// The WM_ENTERMENULOOP message informs an application's main window procedure that a menu modal loop has been entered.
  730. /// </summary>
  731. ENTERMENULOOP = 0x0211,
  732. /// <summary>
  733. /// The WM_EXITMENULOOP message informs an application's main window procedure that a menu modal loop has been exited.
  734. /// </summary>
  735. EXITMENULOOP = 0x0212,
  736. /// <summary>
  737. /// The WM_NEXTMENU message is sent to an application when the right or left arrow key is used to switch between the menu bar and the system menu.
  738. /// </summary>
  739. NEXTMENU = 0x0213,
  740. /// <summary>
  741. /// The WM_SIZING message is sent to a window that the user is resizing. By processing this message, an application can monitor the size and position of the drag rectangle and, if needed, change its size or position.
  742. /// </summary>
  743. SIZING = 0x0214,
  744. /// <summary>
  745. /// The WM_CAPTURECHANGED message is sent to the window that is losing the mouse capture.
  746. /// </summary>
  747. CAPTURECHANGED = 0x0215,
  748. /// <summary>
  749. /// The WM_MOVING message is sent to a window that the user is moving. By processing this message, an application can monitor the position of the drag rectangle and, if needed, change its position.
  750. /// </summary>
  751. MOVING = 0x0216,
  752. /// <summary>
  753. /// Notifies applications that a power-management event has occurred.
  754. /// </summary>
  755. POWERBROADCAST = 0x0218,
  756. /// <summary>
  757. /// Notifies an application of a change to the hardware configuration of a device or the computer.
  758. /// </summary>
  759. DEVICECHANGE = 0x0219,
  760. /// <summary>
  761. /// An application sends the WM_MDICREATE message to a multiple-document interface (MDI) client window to create an MDI child window.
  762. /// </summary>
  763. MDICREATE = 0x0220,
  764. /// <summary>
  765. /// An application sends the WM_MDIDESTROY message to a multiple-document interface (MDI) client window to close an MDI child window.
  766. /// </summary>
  767. MDIDESTROY = 0x0221,
  768. /// <summary>
  769. /// An application sends the WM_MDIACTIVATE message to a multiple-document interface (MDI) client window to instruct the client window to activate a different MDI child window.
  770. /// </summary>
  771. MDIACTIVATE = 0x0222,
  772. /// <summary>
  773. /// An application sends the WM_MDIRESTORE message to a multiple-document interface (MDI) client window to restore an MDI child window from maximized or minimized size.
  774. /// </summary>
  775. MDIRESTORE = 0x0223,
  776. /// <summary>
  777. /// An application sends the WM_MDINEXT message to a multiple-document interface (MDI) client window to activate the next or previous child window.
  778. /// </summary>
  779. MDINEXT = 0x0224,
  780. /// <summary>
  781. /// An application sends the WM_MDIMAXIMIZE message to a multiple-document interface (MDI) client window to maximize an MDI child window. The system resizes the child window to make its client area fill the client window. The system places the child window's window menu icon in the rightmost position of the frame window's menu bar, and places the child window's restore icon in the leftmost position. The system also appends the title bar text of the child window to that of the frame window.
  782. /// </summary>
  783. MDIMAXIMIZE = 0x0225,
  784. /// <summary>
  785. /// An application sends the WM_MDITILE message to a multiple-document interface (MDI) client window to arrange all of its MDI child windows in a tile format.
  786. /// </summary>
  787. MDITILE = 0x0226,
  788. /// <summary>
  789. /// An application sends the WM_MDICASCADE message to a multiple-document interface (MDI) client window to arrange all its child windows in a cascade format.
  790. /// </summary>
  791. MDICASCADE = 0x0227,
  792. /// <summary>
  793. /// An application sends the WM_MDIICONARRANGE message to a multiple-document interface (MDI) client window to arrange all minimized MDI child windows. It does not affect child windows that are not minimized.
  794. /// </summary>
  795. MDIICONARRANGE = 0x0228,
  796. /// <summary>
  797. /// An application sends the WM_MDIGETACTIVE message to a multiple-document interface (MDI) client window to retrieve the handle to the active MDI child window.
  798. /// </summary>
  799. MDIGETACTIVE = 0x0229,
  800. /// <summary>
  801. /// An application sends the WM_MDISETMENU message to a multiple-document interface (MDI) client window to replace the entire menu of an MDI frame window, to replace the window menu of the frame window, or both.
  802. /// </summary>
  803. MDISETMENU = 0x0230,
  804. /// <summary>
  805. /// The WM_ENTERSIZEMOVE message is sent one time to a window after it enters the moving or sizing modal loop. The window enters the moving or sizing modal loop when the user clicks the window's title bar or sizing border, or when the window passes the WM_SYSCOMMAND message to the DefWindowProc function and the wParam parameter of the message specifies the SC_MOVE or SC_SIZE value. The operation is complete when DefWindowProc returns.
  806. /// The system sends the WM_ENTERSIZEMOVE message regardless of whether the dragging of full windows is enabled.
  807. /// </summary>
  808. ENTERSIZEMOVE = 0x0231,
  809. /// <summary>
  810. /// The WM_EXITSIZEMOVE message is sent one time to a window, after it has exited the moving or sizing modal loop. The window enters the moving or sizing modal loop when the user clicks the window's title bar or sizing border, or when the window passes the WM_SYSCOMMAND message to the DefWindowProc function and the wParam parameter of the message specifies the SC_MOVE or SC_SIZE value. The operation is complete when DefWindowProc returns.
  811. /// </summary>
  812. EXITSIZEMOVE = 0x0232,
  813. /// <summary>
  814. /// Sent when the user drops a file on the window of an application that has registered itself as a recipient of dropped files.
  815. /// </summary>
  816. DROPFILES = 0x0233,
  817. /// <summary>
  818. /// An application sends the WM_MDIREFRESHMENU message to a multiple-document interface (MDI) client window to refresh the window menu of the MDI frame window.
  819. /// </summary>
  820. MDIREFRESHMENU = 0x0234,
  821. /// <summary>
  822. /// Sent to an application when a window is activated. A window receives this message through its WindowProc function.
  823. /// </summary>
  824. IME_SETCONTEXT = 0x0281,
  825. /// <summary>
  826. /// Sent to an application to notify it of changes to the IME window. A window receives this message through its WindowProc function.
  827. /// </summary>
  828. IME_NOTIFY = 0x0282,
  829. /// <summary>
  830. /// Sent by an application to direct the IME window to carry out the requested command. The application uses this message to control the IME window that it has created. To send this message, the application calls the SendMessage function with the following parameters.
  831. /// </summary>
  832. IME_CONTROL = 0x0283,
  833. /// <summary>
  834. /// Sent to an application when the IME window finds no space to extend the area for the composition window. A window receives this message through its WindowProc function.
  835. /// </summary>
  836. IME_COMPOSITIONFULL = 0x0284,
  837. /// <summary>
  838. /// Sent to an application when the operating system is about to change the current IME. A window receives this message through its WindowProc function.
  839. /// </summary>
  840. IME_SELECT = 0x0285,
  841. /// <summary>
  842. /// Sent to an application when the IME gets a character of the conversion result. A window receives this message through its WindowProc function.
  843. /// </summary>
  844. IME_CHAR = 0x0286,
  845. /// <summary>
  846. /// Sent to an application to provide commands and request information. A window receives this message through its WindowProc function.
  847. /// </summary>
  848. IME_REQUEST = 0x0288,
  849. /// <summary>
  850. /// Sent to an application by the IME to notify the application of a key press and to keep message order. A window receives this message through its WindowProc function.
  851. /// </summary>
  852. IME_KEYDOWN = 0x0290,
  853. /// <summary>
  854. /// Sent to an application by the IME to notify the application of a key release and to keep message order. A window receives this message through its WindowProc function.
  855. /// </summary>
  856. IME_KEYUP = 0x0291,
  857. /// <summary>
  858. /// The WM_MOUSEHOVER message is posted to a window when the cursor hovers over the client area of the window for the period of time specified in a prior call to TrackMouseEvent.
  859. /// </summary>
  860. MOUSEHOVER = 0x02A1,
  861. /// <summary>
  862. /// The WM_MOUSELEAVE message is posted to a window when the cursor leaves the client area of the window specified in a prior call to TrackMouseEvent.
  863. /// </summary>
  864. MOUSELEAVE = 0x02A3,
  865. /// <summary>
  866. /// The WM_NCMOUSEHOVER message is posted to a window when the cursor hovers over the nonclient area of the window for the period of time specified in a prior call to TrackMouseEvent.
  867. /// </summary>
  868. NCMOUSEHOVER = 0x02A0,
  869. /// <summary>
  870. /// The WM_NCMOUSELEAVE message is posted to a window when the cursor leaves the nonclient area of the window specified in a prior call to TrackMouseEvent.
  871. /// </summary>
  872. NCMOUSELEAVE = 0x02A2,
  873. /// <summary>
  874. /// The WM_WTSSESSION_CHANGE message notifies applications of changes in session state.
  875. /// </summary>
  876. WTSSESSION_CHANGE = 0x02B1,
  877. TABLET_FIRST = 0x02c0,
  878. TABLET_LAST = 0x02df,
  879. /// <summary>
  880. /// An application sends a WM_CUT message to an edit control or combo box to delete (cut) the current selection, if any, in the edit control and copy the deleted text to the clipboard in CF_TEXT format.
  881. /// </summary>
  882. CUT = 0x0300,
  883. /// <summary>
  884. /// An application sends the WM_COPY message to an edit control or combo box to copy the current selection to the clipboard in CF_TEXT format.
  885. /// </summary>
  886. COPY = 0x0301,
  887. /// <summary>
  888. /// An application sends a WM_PASTE message to an edit control or combo box to copy the current content of the clipboard to the edit control at the current caret position. Data is inserted only if the clipboard contains data in CF_TEXT format.
  889. /// </summary>
  890. PASTE = 0x0302,
  891. /// <summary>
  892. /// An application sends a WM_CLEAR message to an edit control or combo box to delete (clear) the current selection, if any, from the edit control.
  893. /// </summary>
  894. CLEAR = 0x0303,
  895. /// <summary>
  896. /// An application sends a WM_UNDO message to an edit control to undo the last operation. When this message is sent to an edit control, the previously deleted text is restored or the previously added text is deleted.
  897. /// </summary>
  898. UNDO = 0x0304,
  899. /// <summary>
  900. /// The WM_RENDERFORMAT message is sent to the clipboard owner if it has delayed rendering a specific clipboard format and if an application has requested data in that format. The clipboard owner must render data in the specified format and place it on the clipboard by calling the SetClipboardData function.
  901. /// </summary>
  902. RENDERFORMAT = 0x0305,
  903. /// <summary>
  904. /// The WM_RENDERALLFORMATS message is sent to the clipboard owner before it is destroyed, if the clipboard owner has delayed rendering one or more clipboard formats. For the content of the clipboard to remain available to other applications, the clipboard owner must render data in all the formats it is capable of generating, and place the data on the clipboard by calling the SetClipboardData function.
  905. /// </summary>
  906. RENDERALLFORMATS = 0x0306,
  907. /// <summary>
  908. /// The WM_DESTROYCLIPBOARD message is sent to the clipboard owner when a call to the EmptyClipboard function empties the clipboard.
  909. /// </summary>
  910. DESTROYCLIPBOARD = 0x0307,
  911. /// <summary>
  912. /// The WM_DRAWCLIPBOARD message is sent to the first window in the clipboard viewer chain when the content of the clipboard changes. This enables a clipboard viewer window to display the new content of the clipboard.
  913. /// </summary>
  914. DRAWCLIPBOARD = 0x0308,
  915. /// <summary>
  916. /// The WM_PAINTCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area needs repainting.
  917. /// </summary>
  918. PAINTCLIPBOARD = 0x0309,
  919. /// <summary>
  920. /// The WM_VSCROLLCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's vertical scroll bar. The owner should scroll the clipboard image and update the scroll bar values.
  921. /// </summary>
  922. VSCROLLCLIPBOARD = 0x030A,
  923. /// <summary>
  924. /// The WM_SIZECLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area has changed size.
  925. /// </summary>
  926. SIZECLIPBOARD = 0x030B,
  927. /// <summary>
  928. /// The WM_ASKCBFORMATNAME message is sent to the clipboard owner by a clipboard viewer window to request the name of a CF_OWNERDISPLAY clipboard format.
  929. /// </summary>
  930. ASKCBFORMATNAME = 0x030C,
  931. /// <summary>
  932. /// The WM_CHANGECBCHAIN message is sent to the first window in the clipboard viewer chain when a window is being removed from the chain.
  933. /// </summary>
  934. CHANGECBCHAIN = 0x030D,
  935. /// <summary>
  936. /// The WM_HSCROLLCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window. This occurs when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's horizontal scroll bar. The owner should scroll the clipboard image and update the scroll bar values.
  937. /// </summary>
  938. HSCROLLCLIPBOARD = 0x030E,
  939. /// <summary>
  940. /// This message informs a window that it is about to receive the keyboard focus, giving the window the opportunity to realize its logical palette when it receives the focus.
  941. /// </summary>
  942. QUERYNEWPALETTE = 0x030F,
  943. /// <summary>
  944. /// The WM_PALETTEISCHANGING message informs applications that an application is going to realize its logical palette.
  945. /// </summary>
  946. PALETTEISCHANGING = 0x0310,
  947. /// <summary>
  948. /// This message is sent by the OS to all top-level and overlapped windows after the window with the keyboard focus realizes its logical palette.
  949. /// This message enables windows that do not have the keyboard focus to realize their logical palettes and update their client areas.
  950. /// </summary>
  951. PALETTECHANGED = 0x0311,
  952. /// <summary>
  953. /// The WM_HOTKEY message is posted when the user presses a hot key registered by the RegisterHotKey function. The message is placed at the top of the message queue associated with the thread that registered the hot key.
  954. /// </summary>
  955. HOTKEY = 0x0312,
  956. /// <summary>
  957. /// The WM_PRINT message is sent to a window to request that it draw itself in the specified device context, most commonly in a printer device context.
  958. /// </summary>
  959. PRINT = 0x0317,
  960. /// <summary>
  961. /// The WM_PRINTCLIENT message is sent to a window to request that it draw its client area in the specified device context, most commonly in a printer device context.
  962. /// </summary>
  963. PRINTCLIENT = 0x0318,
  964. /// <summary>
  965. /// The WM_APPCOMMAND message notifies a window that the user generated an application command event, for example, by clicking an application command button using the mouse or typing an application command key on the keyboard.
  966. /// </summary>
  967. APPCOMMAND = 0x0319,
  968. /// <summary>
  969. /// The WM_THEMECHANGED message is broadcast to every window following a theme change event. Examples of theme change events are the activation of a theme, the deactivation of a theme, or a transition from one theme to another.
  970. /// </summary>
  971. THEMECHANGED = 0x031A,
  972. /// <summary>
  973. /// Sent when the contents of the clipboard have changed.
  974. /// </summary>
  975. CLIPBOARDUPDATE = 0x031D,
  976. /// <summary>
  977. /// The system will send a window the WM_DWMCOMPOSITIONCHANGED message to indicate that the availability of desktop composition has changed.
  978. /// </summary>
  979. DWMCOMPOSITIONCHANGED = 0x031E,
  980. /// <summary>
  981. /// WM_DWMNCRENDERINGCHANGED is called when the non-client area rendering status of a window has changed. Only windows that have set the flag DWM_BLURBEHIND.fTransitionOnMaximized to true will get this message.
  982. /// </summary>
  983. DWMNCRENDERINGCHANGED = 0x031F,
  984. /// <summary>
  985. /// Sent to all top-level windows when the colorization color has changed.
  986. /// </summary>
  987. DWMCOLORIZATIONCOLORCHANGED = 0x0320,
  988. /// <summary>
  989. /// WM_DWMWINDOWMAXIMIZEDCHANGE will let you know when a DWM composed window is maximized. You also have to register for this message as well. You'd have other windowd go opaque when this message is sent.
  990. /// </summary>
  991. DWMWINDOWMAXIMIZEDCHANGE = 0x0321,
  992. /// <summary>
  993. /// Sent to request extended title bar information. A window receives this message through its WindowProc function.
  994. /// </summary>
  995. GETTITLEBARINFOEX = 0x033F,
  996. HANDHELDFIRST = 0x0358,
  997. HANDHELDLAST = 0x035F,
  998. AFXFIRST = 0x0360,
  999. AFXLAST = 0x037F,
  1000. PENWINFIRST = 0x0380,
  1001. PENWINLAST = 0x038F,
  1002. /// <summary>
  1003. /// The WM_APP constant is used by applications to help define private messages, usually of the form WM_APP+X, where X is an integer value.
  1004. /// </summary>
  1005. APP = 0x8000,
  1006. /// <summary>
  1007. /// The WM_USER constant is used by applications to help define private messages for use by private window classes, usually of the form WM_USER+X, where X is an integer value.
  1008. /// </summary>
  1009. USER = 0x0400,
  1010. /// <summary>
  1011. /// An application sends the WM_CPL_LAUNCH message to Windows Control Panel to request that a Control Panel application be started.
  1012. /// </summary>
  1013. CPL_LAUNCH = USER + 0x1000,
  1014. /// <summary>
  1015. /// The WM_CPL_LAUNCHED message is sent when a Control Panel application, started by the WM_CPL_LAUNCH message, has closed. The WM_CPL_LAUNCHED message is sent to the window identified by the wParam parameter of the WM_CPL_LAUNCH message that started the application.
  1016. /// </summary>
  1017. CPL_LAUNCHED = USER + 0x1001,
  1018. /// <summary>
  1019. /// WM_SYSTIMER is a well-known yet still undocumented message. Windows uses WM_SYSTIMER for internal actions like scrolling.
  1020. /// </summary>
  1021. SYSTIMER = 0x118,
  1022. /// <summary>
  1023. /// The accessibility state has changed.
  1024. /// </summary>
  1025. HSHELL_ACCESSIBILITYSTATE = 11,
  1026. /// <summary>
  1027. /// The shell should activate its main window.
  1028. /// </summary>
  1029. HSHELL_ACTIVATESHELLWINDOW = 3,
  1030. /// <summary>
  1031. /// The user completed an input event (for example, pressed an application command button on the mouse or an application command key on the keyboard), and the application did not handle the WM_APPCOMMAND message generated by that input.
  1032. /// If the Shell procedure handles the WM_COMMAND message, it should not call CallNextHookEx. See the Return Value section for more information.
  1033. /// </summary>
  1034. HSHELL_APPCOMMAND = 12,
  1035. /// <summary>
  1036. /// A window is being minimized or maximized. The system needs the coordinates of the minimized rectangle for the window.
  1037. /// </summary>
  1038. HSHELL_GETMINRECT = 5,
  1039. /// <summary>
  1040. /// Keyboard language was changed or a new keyboard layout was loaded.
  1041. /// </summary>
  1042. HSHELL_LANGUAGE = 8,
  1043. /// <summary>
  1044. /// The title of a window in the task bar has been redrawn.
  1045. /// </summary>
  1046. HSHELL_REDRAW = 6,
  1047. /// <summary>
  1048. /// The user has selected the task list. A shell application that provides a task list should return TRUE to prevent Windows from starting its task list.
  1049. /// </summary>
  1050. HSHELL_TASKMAN = 7,
  1051. /// <summary>
  1052. /// A top-level, unowned window has been created. The window exists when the system calls this hook.
  1053. /// </summary>
  1054. HSHELL_WINDOWCREATED = 1,
  1055. /// <summary>
  1056. /// A top-level, unowned window is about to be destroyed. The window still exists when the system calls this hook.
  1057. /// </summary>
  1058. HSHELL_WINDOWDESTROYED = 2,
  1059. /// <summary>
  1060. /// The activation has changed to a different top-level, unowned window.
  1061. /// </summary>
  1062. HSHELL_WINDOWACTIVATED = 4,
  1063. /// <summary>
  1064. /// A top-level window is being replaced. The window exists when the system calls this hook.
  1065. /// </summary>
  1066. HSHELL_WINDOWREPLACED = 13
  1067. }
  1068. public struct SHFILEINFO
  1069. {
  1070. public IntPtr hIcon;
  1071. public int iIcon;
  1072. public uint dwAttributes;
  1073. [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
  1074. public string szDisplayName;
  1075. [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
  1076. public string szTypeName;
  1077. }
  1078. public class WinApi
  1079. {
  1080. [DllImport("kernel32.dll", EntryPoint = "RtlFillMemory", SetLastError = false)]
  1081. public static extern void FillMemory(IntPtr destination, uint length, byte fill);
  1082. [DllImport("user32.dll", CharSet = CharSet.Auto)]
  1083. static public extern bool UpdateWindow(IntPtr hWnd);
  1084. [DllImport("user32", EntryPoint = "ScreenToClient")]
  1085. public static extern int ScreenToClient(
  1086. IntPtr hwnd,
  1087. ref Point lpPoint
  1088. );
  1089. #region DT
  1090. public const uint DT_TOP = 0x00000000;
  1091. public const uint DT_LEFT = 0x00000000;
  1092. public const uint DT_CENTER = 0x00000001;
  1093. public const uint DT_RIGHT = 0x00000002;
  1094. public const uint DT_VCENTER = 0x00000004;
  1095. public const uint DT_BOTTOM = 0x00000008;
  1096. public const uint DT_WORDBREAK = 0x00000010;
  1097. public const uint DT_SINGLELINE = 0x00000020;
  1098. public const uint DT_EXPANDTABS = 0x00000040;
  1099. public const uint DT_TABSTOP = 0x00000080;
  1100. public const uint DT_NOCLIP = 0x00000100;
  1101. public const uint DT_EXTERNALLEADING = 0x00000200;
  1102. public const uint DT_CALCRECT = 0x00000400;
  1103. public const uint DT_NOPREFIX = 0x00000800;
  1104. public const uint DT_INTERNAL = 0x00001000;
  1105. #endregion
  1106. [DllImport("User32.dll", EntryPoint = "DestroyIcon")]
  1107. public static extern int DestroyIcon(IntPtr hIcon);
  1108. [DllImport("Shell32.dll", EntryPoint = "SHGetFileInfo", SetLastError = true, CharSet = CharSet.Auto)]
  1109. public static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbFileInfo, uint uFlags);
  1110. [DllImport("shell32.dll")]
  1111. public static extern uint ExtractIconEx(string lpszFile, int nIconIndex, int[] phiconLarge, int[] phiconSmall, uint nIcons);
  1112. [DllImport("user32.dll")]
  1113. public static extern uint MapVirtualKey(uint uCode, uint uMapType);
  1114. [DllImport("user32.dll")]
  1115. public static extern int DrawText(IntPtr hDC, string lpString, int nCount, ref RECT lpRect, uint uFormat);
  1116. [DllImport("User32.dll", EntryPoint = "FindWindowA")]
  1117. public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
  1118. [DllImport("gdi32.dll")]
  1119. public static extern int SetStretchBltMode(IntPtr hdc, StretchBltMode iStretchMode);
  1120. [DllImport("gdi32.dll")]
  1121. public static extern bool StretchBlt(IntPtr hdcDest, int nXOriginDest, int nYOriginDest,
  1122. int nWidthDest, int nHeightDest,
  1123. IntPtr hdcSrc, int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc,
  1124. TernaryRasterOperations dwRop);
  1125. [DllImport("user32.dll", SetLastError = true)]
  1126. public static extern IntPtr GetDC(IntPtr hWnd);
  1127. [DllImport("user32.dll")]
  1128. public static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDC);
  1129. [DllImport("User32.DLL")]
  1130. public static extern IntPtr FindWindowEx(IntPtr hwndParent,
  1131. IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
  1132. [DllImport("User32.dll")]
  1133. public static extern IntPtr GetActiveWindow();
  1134. [DllImport("User32.dll")]
  1135. public static extern IntPtr GetFocus();
  1136. [DllImport("User32.dll")]
  1137. public static extern int CloseWindow(IntPtr hwnd);
  1138. //Declare Function CloseWindow Lib "user32" Alias "CloseWindow" (ByVal hwnd As Long) As Long
  1139. [DllImport("User32.DLL", EntryPoint = "PostMessageA")]
  1140. public static extern int PostMessage(int hWnd,
  1141. int msg, int wParam, int lParam);
  1142. [DllImport("User32.DLL", EntryPoint = "SendMessageA")]
  1143. public static extern int SendMessage(IntPtr hWnd,
  1144. WindowsMessage msg, int wParam, int lParam);
  1145. [DllImport("User32.DLL", EntryPoint = "PostMessageA")]
  1146. public static extern int PostMessage(IntPtr hWnd,
  1147. WindowsMessage msg, int wParam, int lParam);
  1148. [DllImport("User32.DLL", EntryPoint = "SendMessageA")]
  1149. public static extern int SendMessage(IntPtr hWnd,
  1150. WindowsMessage msg, int wParam, StringBuilder lParam);
  1151. [DllImport("User32.DLL", EntryPoint = "SendMessageA")]
  1152. public static extern int SendMessage(IntPtr hWnd,
  1153. WindowsMessage msg, int wParam, string lParam);
  1154. [DllImport("User32.DLL")]
  1155. public static extern int GetWindowThreadProcessId(IntPtr hwnd, out int processId);
  1156. [DllImport("User32.DLL")]
  1157. public static extern int AttachThreadInput(int idAttach, int idAttachTo, bool fAttach);
  1158. [DllImport("User32.DLL")]
  1159. public static extern int SetForegroundWindow(IntPtr hwnd);
  1160. [DllImport("User32.DLL")]
  1161. public static extern int SetActiveWindow(IntPtr hwnd);
  1162. [DllImport("User32.DLL")]
  1163. public static extern int SetFocus(IntPtr hwnd);
  1164. [DllImport("User32.DLL")]
  1165. public static extern IntPtr GetParent(IntPtr hwnd);
  1166. [DllImport("user32.dll")]
  1167. public static extern bool GetClientRect(IntPtr hWnd, out RECT lpRect);
  1168. [DllImport("user32.dll")]
  1169. public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
  1170. /*
  1171. BOOL ClipCursor(
  1172. CONST RECT *lpRect // screen coordinates
  1173. );*/
  1174. [DllImport("user32.dll")]
  1175. public static extern bool ClipCursor(ref RECT lpRect);
  1176. [DllImport("user32.dll")]
  1177. public static extern bool ClipCursor(IntPtr lpRect);
  1178. [DllImport("user32.dll", EntryPoint = "SetWindowTextA")]
  1179. public static extern bool SetWindowText(IntPtr hWnd, string lpString);
  1180. [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
  1181. public static extern IntPtr GetForegroundWindow();
  1182. [DllImport("psapi.dll")]
  1183. public static extern uint GetProcessImageFileName(
  1184. IntPtr hProcess,
  1185. [Out] StringBuilder lpImageFileName,
  1186. [In] [MarshalAs(UnmanagedType.U4)] int nSize
  1187. );
  1188. //Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
  1189. [DllImport("User32.DLL")]
  1190. public static extern int SetParent(IntPtr child, IntPtr parent);
  1191. [DllImport("User32.DLL")]
  1192. public static extern IntPtr GetDesktopWindow();
  1193. [DllImport("user32.dll", SetLastError = true)]
  1194. public static extern bool IsIconic(
  1195. IntPtr hwnd
  1196. );
  1197. [DllImport("user32.dll")]
  1198. public static extern int ShowWindow(IntPtr hwnd, EnumSW nCmdShow);
  1199. [DllImport("user32.dll")]
  1200. public static extern bool IsWindowVisible(IntPtr hwnd);
  1201. //Declare Function IsWindowVisible Lib "user32" Alias "IsWindowVisible" (ByVal hwnd As Long) As Long
  1202. public enum EnumSW : int
  1203. {
  1204. SW_HIDE = 0,
  1205. SW_INVALIDATE = 0x2,
  1206. SW_MAX = 10,
  1207. SW_MAXIMIZE = 3,
  1208. SW_MINIMIZE = 6,
  1209. SW_NORMAL = 1,
  1210. SW_OTHERUNZOOM = 4,
  1211. SW_OTHERZOOM = 2,
  1212. SW_PARENTCLOSING = 1,
  1213. SW_PARENTOPENING = 3,
  1214. SW_RESTORE = 9,
  1215. SW_SCROLLCHILDREN = 0x1,
  1216. SW_SHOW = 5,
  1217. SW_SHOWDEFAULT = 10,
  1218. SW_SHOWMAXIMIZED = 3,
  1219. SW_SHOWMINIMIZED = 2,
  1220. SW_SHOWMINNOACTIVE = 7,
  1221. SW_SHOWNA = 8,
  1222. SW_SHOWNOACTIVATE = 4,
  1223. SW_SHOWNORMAL = 1,
  1224. SW_ERASE = 0x4
  1225. }
  1226. public enum GW : int
  1227. {
  1228. GW_HWNDFIRST = 0,
  1229. GW_CHILD = 5,
  1230. GW_HWNDNEXT = 2
  1231. }
  1232. [DllImport("user32.dll", SetLastError = true)]
  1233. public static extern IntPtr GetWindow(
  1234. IntPtr hwnd,
  1235. GW wCmd
  1236. );
  1237. [DllImport("user32.dll", EntryPoint = "GetClassNameA")]
  1238. public static extern int GetClassName(
  1239. IntPtr hwnd,
  1240. StringBuilder className,
  1241. int maxLength
  1242. );
  1243. [DllImport("user32.dll", EntryPoint = "GetWindowTextA")]
  1244. public static extern int GetWindowText(
  1245. IntPtr hwnd,
  1246. StringBuilder text,
  1247. int maxLength
  1248. );
  1249. [DllImport("user32.dll")]
  1250. public static extern void keybd_event(
  1251. VK bVk,
  1252. byte bScan,
  1253. KeybdEventFlag dwFlags,
  1254. int dwExtraInfo
  1255. );
  1256. [DllImport("user32.dll", CharSet = CharSet.Auto)]
  1257. public static extern IntPtr SendMessage(IntPtr hWnd, WM Msg, IntPtr wParam, IntPtr lParam);
  1258. [DllImport("user32.dll", CharSet = CharSet.Auto)]
  1259. public static extern IntPtr SendMessage(IntPtr hWnd, WM Msg, int wParam, int lParam);
  1260. [DllImport("user32.dll")]
  1261. public static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData,
  1262. UIntPtr dwExtraInfo);
  1263. [DllImport("user32.dll")]
  1264. public static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData,
  1265. int dwExtraInfo);
  1266. public static int MakePoint(int x, int y)
  1267. {
  1268. return (y << 16) | x;
  1269. }
  1270. }
  1271. [Flags]
  1272. public enum MouseEventFlags : uint
  1273. {
  1274. LEFTDOWN = 0x00000002,
  1275. LEFTUP = 0x00000004,
  1276. MIDDLEDOWN = 0x00000020,
  1277. MIDDLEUP = 0x00000040,
  1278. MOVE = 0x00000001,
  1279. ABSOLUTE = 0x00008000,
  1280. RIGHTDOWN = 0x00000008,
  1281. RIGHTUP = 0x00000010,
  1282. WHEEL = 0x00000800,
  1283. XDOWN = 0x00000080,
  1284. XUP = 0x00000100
  1285. }
  1286. //Use the values of this enum for the 'dwData' parameter
  1287. //to specify an X button when using MouseEventFlags.XDOWN or
  1288. //MouseEventFlags.XUP for the dwFlags parameter.
  1289. public enum MouseEventDataXButtons : uint
  1290. {
  1291. XBUTTON1 = 0x00000001,
  1292. XBUTTON2 = 0x00000002
  1293. }
  1294. public enum VK : int
  1295. {
  1296. /*
  1297. * Virtual Keys, Standard Set
  1298. */
  1299. VK_LBUTTON = 0x01
  1300. ,
  1301. VK_RBUTTON = 0x02
  1302. ,
  1303. VK_CANCEL = 0x03
  1304. ,
  1305. VK_MBUTTON = 0x04 /* NOT contiguous with L & RBUTTON */
  1306. ,
  1307. VK_XBUTTON1 = 0x05 /* NOT contiguous with L & RBUTTON */
  1308. ,
  1309. VK_XBUTTON2 = 0x06 /* NOT contiguous with L & RBUTTON */
  1310. /*
  1311. * =0x07 : unassigned
  1312. */
  1313. ,
  1314. VK_BACK = 0x08
  1315. ,
  1316. VK_TAB = 0x09
  1317. /*
  1318. * =0x0A - =0x0B : reserved
  1319. */
  1320. ,
  1321. VK_CLEAR = 0x0C
  1322. ,
  1323. VK_RETURN = 0x0D
  1324. ,
  1325. VK_SHIFT = 0x10
  1326. ,
  1327. VK_CONTROL = 0x11
  1328. ,
  1329. VK_MENU = 0x12
  1330. ,
  1331. VK_PAUSE = 0x13
  1332. ,
  1333. VK_CAPITAL = 0x14
  1334. ,
  1335. VK_KANA = 0x15
  1336. ,
  1337. VK_HANGEUL = 0x15 /* old name - should be here for compatibility */
  1338. ,
  1339. VK_HANGUL = 0x15
  1340. ,
  1341. VK_JUNJA = 0x17
  1342. ,
  1343. VK_FINAL = 0x18
  1344. ,
  1345. VK_HANJA = 0x19
  1346. ,
  1347. VK_KANJI = 0x19
  1348. ,
  1349. VK_ESCAPE = 0x1B
  1350. ,
  1351. VK_CONVERT = 0x1C
  1352. ,
  1353. VK_NONCONVERT = 0x1D
  1354. ,
  1355. VK_ACCEPT = 0x1E
  1356. ,
  1357. VK_MODECHANGE = 0x1F
  1358. ,
  1359. VK_SPACE = 0x20
  1360. ,
  1361. VK_PRIOR = 0x21
  1362. ,
  1363. VK_NEXT = 0x22
  1364. ,
  1365. VK_END = 0x23
  1366. ,
  1367. VK_HOME = 0x24
  1368. ,
  1369. VK_LEFT = 0x25
  1370. ,
  1371. VK_UP = 0x26
  1372. ,
  1373. VK_RIGHT = 0x27
  1374. ,
  1375. VK_DOWN = 0x28
  1376. ,
  1377. VK_SELECT = 0x29
  1378. ,
  1379. VK_PRINT = 0x2A
  1380. ,
  1381. VK_EXECUTE = 0x2B
  1382. ,
  1383. VK_SNAPSHOT = 0x2C
  1384. ,
  1385. VK_INSERT = 0x2D
  1386. ,
  1387. VK_DELETE = 0x2E
  1388. ,
  1389. VK_HELP = 0x2F
  1390. /*
  1391. * ,VK_0 - ,VK_9 are the same as ASCII '0' - '9' (=0x30 - =0x39)
  1392. * =0x40 : unassigned
  1393. * ,VK_A - ,VK_Z are the same as ASCII 'A' - 'Z' (=0x41 - =0x5A)
  1394. */
  1395. ,
  1396. VK_LWIN = 0x5B
  1397. ,
  1398. VK_RWIN = 0x5C
  1399. ,
  1400. VK_APPS = 0x5D
  1401. /*
  1402. * =0x5E : reserved
  1403. */
  1404. ,
  1405. VK_SLEEP = 0x5F
  1406. ,
  1407. VK_NUMPAD0 = 0x60
  1408. ,
  1409. VK_NUMPAD1 = 0x61
  1410. ,
  1411. VK_NUMPAD2 = 0x62
  1412. ,
  1413. VK_NUMPAD3 = 0x63
  1414. ,
  1415. VK_NUMPAD4 = 0x64
  1416. ,
  1417. VK_NUMPAD5 = 0x65
  1418. ,
  1419. VK_NUMPAD6 = 0x66
  1420. ,
  1421. VK_NUMPAD7 = 0x67
  1422. ,
  1423. VK_NUMPAD8 = 0x68
  1424. ,
  1425. VK_NUMPAD9 = 0x69
  1426. ,
  1427. VK_MULTIPLY = 0x6A
  1428. ,
  1429. VK_ADD = 0x6B
  1430. ,
  1431. VK_SEPARATOR = 0x6C
  1432. ,
  1433. VK_SUBTRACT = 0x6D
  1434. ,
  1435. VK_DECIMAL = 0x6E
  1436. ,
  1437. VK_DIVIDE = 0x6F
  1438. ,
  1439. VK_F1 = 0x70
  1440. ,
  1441. VK_F2 = 0x71
  1442. ,
  1443. VK_F3 = 0x72
  1444. ,
  1445. VK_F4 = 0x73
  1446. ,
  1447. VK_F5 = 0x74
  1448. ,
  1449. VK_F6 = 0x75
  1450. ,
  1451. VK_F7 = 0x76
  1452. ,
  1453. VK_F8 = 0x77
  1454. ,
  1455. VK_F9 = 0x78
  1456. ,
  1457. VK_F10 = 0x79
  1458. ,
  1459. VK_F11 = 0x7A
  1460. ,
  1461. VK_F12 = 0x7B
  1462. ,
  1463. VK_F13 = 0x7C
  1464. ,
  1465. VK_F14 = 0x7D
  1466. ,
  1467. VK_F15 = 0x7E
  1468. ,
  1469. VK_F16 = 0x7F
  1470. ,
  1471. VK_F17 = 0x80
  1472. ,
  1473. VK_F18 = 0x81
  1474. ,
  1475. VK_F19 = 0x82
  1476. ,
  1477. VK_F20 = 0x83
  1478. ,
  1479. VK_F21 = 0x84
  1480. ,
  1481. VK_F22 = 0x85
  1482. ,
  1483. VK_F23 = 0x86
  1484. ,
  1485. VK_F24 = 0x87
  1486. /*
  1487. * =0x88 - =0x8F : unassigned
  1488. */
  1489. ,
  1490. VK_NUMLOCK = 0x90
  1491. ,
  1492. VK_SCROLL = 0x91
  1493. /*
  1494. * NEC PC-9800 kbd definitions
  1495. */
  1496. ,
  1497. VK_OEM_NEC_EQUAL = 0x92 // '=' key on numpad
  1498. /*
  1499. * Fujitsu/OASYS kbd definitions
  1500. */
  1501. ,
  1502. VK_OEM_FJ_JISHO = 0x92 // 'Dictionary' key
  1503. ,
  1504. VK_OEM_FJ_MASSHOU = 0x93 // 'Unregister word' key
  1505. ,
  1506. VK_OEM_FJ_TOUROKU = 0x94 // 'Register word' key
  1507. ,
  1508. VK_OEM_FJ_LOYA = 0x95 // 'Left OYAYUBI' key
  1509. ,
  1510. VK_OEM_FJ_ROYA = 0x96 // 'Right OYAYUBI' key
  1511. /*
  1512. * =0x97 - =0x9F : unassigned
  1513. */
  1514. /*
  1515. * ,VK_L* & ,VK_R* - left and right Alt, Ctrl and Shift virtual keys.
  1516. * Used only as parameters to GetAsyncKeyState() and GetKeyState().
  1517. * No other API or message will distinguish left and right keys in this way.
  1518. */
  1519. ,
  1520. VK_LSHIFT = 0xA0
  1521. ,
  1522. VK_RSHIFT = 0xA1
  1523. ,
  1524. VK_LCONTROL = 0xA2
  1525. ,
  1526. VK_RCONTROL = 0xA3
  1527. ,
  1528. VK_LMENU = 0xA4
  1529. ,
  1530. VK_RMENU = 0xA5
  1531. ,
  1532. VK_BROWSER_BACK = 0xA6
  1533. ,
  1534. VK_BROWSER_FORWARD = 0xA7
  1535. ,
  1536. VK_BROWSER_REFRESH = 0xA8
  1537. ,
  1538. VK_BROWSER_STOP = 0xA9
  1539. ,
  1540. VK_BROWSER_SEARCH = 0xAA
  1541. ,
  1542. VK_BROWSER_FAVORITES = 0xAB
  1543. ,
  1544. VK_BROWSER_HOME = 0xAC
  1545. ,
  1546. VK_VOLUME_MUTE = 0xAD
  1547. ,
  1548. VK_VOLUME_DOWN = 0xAE
  1549. ,
  1550. VK_VOLUME_UP = 0xAF
  1551. ,
  1552. VK_MEDIA_NEXT_TRACK = 0xB0
  1553. ,
  1554. VK_MEDIA_PREV_TRACK = 0xB1
  1555. ,
  1556. VK_MEDIA_STOP = 0xB2
  1557. ,
  1558. VK_MEDIA_PLAY_PAUSE = 0xB3
  1559. ,
  1560. VK_LAUNCH_MAIL = 0xB4
  1561. ,
  1562. VK_LAUNCH_MEDIA_SELECT = 0xB5
  1563. ,
  1564. VK_LAUNCH_APP1 = 0xB6
  1565. ,
  1566. VK_LAUNCH_APP2 = 0xB7
  1567. /*
  1568. * =0xB8 - =0xB9 : reserved
  1569. */
  1570. ,
  1571. VK_OEM_1 = 0xBA // ';:' for US
  1572. ,
  1573. VK_OEM_PLUS = 0xBB // '+' any country
  1574. ,
  1575. VK_OEM_COMMA = 0xBC // ',' any country
  1576. ,
  1577. VK_OEM_MINUS = 0xBD // '-' any country
  1578. ,
  1579. VK_OEM_PERIOD = 0xBE // '.' any country
  1580. ,
  1581. VK_OEM_2 = 0xBF // '/?' for US
  1582. ,
  1583. VK_OEM_3 = 0xC0 // '`~' for US
  1584. /*
  1585. * =0xC1 - =0xD7 : reserved
  1586. */
  1587. /*
  1588. * =0xD8 - =0xDA : unassigned
  1589. */
  1590. ,
  1591. VK_OEM_4 = 0xDB // '[{' for US
  1592. ,
  1593. VK_OEM_5 = 0xDC // '\|' for US
  1594. ,
  1595. VK_OEM_6 = 0xDD // ']}' for US
  1596. ,
  1597. VK_OEM_7 = 0xDE // ''"' for US
  1598. ,
  1599. VK_OEM_8 = 0xDF
  1600. /*
  1601. * =0xE0 : reserved
  1602. */
  1603. /*
  1604. * Various extended or enhanced keyboards
  1605. */
  1606. ,
  1607. VK_OEM_AX = 0xE1 // 'AX' key on Japanese AX kbd
  1608. ,
  1609. VK_OEM_102 = 0xE2 // "<>" or "\|" on RT 102-key kbd.
  1610. ,
  1611. VK_ICO_HELP = 0xE3 // Help key on ICO
  1612. ,
  1613. VK_ICO_00 = 0xE4 // 00 key on ICO
  1614. ,
  1615. VK_PROCESSKEY = 0xE5
  1616. ,
  1617. VK_ICO_CLEAR = 0xE6
  1618. ,
  1619. VK_PACKET = 0xE7
  1620. /*
  1621. * =0xE8 : unassigned
  1622. */
  1623. /*
  1624. * Nokia/Ericsson definitions
  1625. */
  1626. ,
  1627. VK_OEM_RESET = 0xE9
  1628. ,
  1629. VK_OEM_JUMP = 0xEA
  1630. ,
  1631. VK_OEM_PA1 = 0xEB
  1632. ,
  1633. VK_OEM_PA2 = 0xEC
  1634. ,
  1635. VK_OEM_PA3 = 0xED
  1636. ,
  1637. VK_OEM_WSCTRL = 0xEE
  1638. ,
  1639. VK_OEM_CUSEL = 0xEF
  1640. ,
  1641. VK_OEM_ATTN = 0xF0
  1642. ,
  1643. VK_OEM_FINISH = 0xF1
  1644. ,
  1645. VK_OEM_COPY = 0xF2
  1646. ,
  1647. VK_OEM_AUTO = 0xF3
  1648. ,
  1649. VK_OEM_ENLW = 0xF4
  1650. ,
  1651. VK_OEM_BACKTAB = 0xF5
  1652. ,
  1653. VK_ATTN = 0xF6
  1654. ,
  1655. VK_CRSEL = 0xF7
  1656. ,
  1657. VK_EXSEL = 0xF8
  1658. ,
  1659. VK_EREOF = 0xF9
  1660. ,
  1661. VK_PLAY = 0xFA
  1662. ,
  1663. VK_ZOOM = 0xFB
  1664. ,
  1665. VK_NONAME = 0xFC
  1666. ,
  1667. VK_PA1 = 0xFD
  1668. , VK_OEM_CLEAR = 0xFE,
  1669. VK_V = 86
  1670. }