user32.odin 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. // +build windows
  2. package sys_windows
  3. foreign import user32 "system:User32.lib"
  4. @(default_calling_convention="stdcall")
  5. foreign user32 {
  6. GetClassInfoW :: proc(hInstance: HINSTANCE, lpClassNAme: LPCWSTR, lpWndClass: ^WNDCLASSW) -> BOOL ---
  7. GetClassInfoExW :: proc(hInsatnce: HINSTANCE, lpszClass: LPCWSTR, lpwcx: ^WNDCLASSEXW) -> BOOL ---
  8. GetClassLongW :: proc(hWnd: HWND, nIndex: c_int) -> DWORD ---
  9. SetClassLongW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG) -> DWORD ---
  10. GetWindowLongW :: proc(hWnd: HWND, nIndex: c_int) -> LONG ---
  11. SetWindowLongW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG) -> LONG ---
  12. GetClassNameW :: proc(hWnd: HWND, lpClassName: LPWSTR, nMaxCount: c_int) -> c_int ---
  13. RegisterClassW :: proc(lpWndClass: ^WNDCLASSW) -> ATOM ---
  14. RegisterClassExW :: proc(^WNDCLASSEXW) -> ATOM ---
  15. UnregisterClassW :: proc(lpClassName: LPCWSTR, hInstance: HINSTANCE) -> BOOL ---
  16. CreateWindowExW :: proc(
  17. dwExStyle: DWORD,
  18. lpClassName: LPCWSTR,
  19. lpWindowName: LPCWSTR,
  20. dwStyle: DWORD,
  21. X: c_int,
  22. Y: c_int,
  23. nWidth: c_int,
  24. nHeight: c_int,
  25. hWndParent: HWND,
  26. hMenu: HMENU,
  27. hInstance: HINSTANCE,
  28. lpParam: LPVOID,
  29. ) -> HWND ---
  30. DestroyWindow :: proc(hWnd: HWND) -> BOOL ---
  31. ShowWindow :: proc(hWnd: HWND, nCmdShow: c_int) -> BOOL ---
  32. BringWindowToTop :: proc(hWnd: HWND) -> BOOL ---
  33. GetTopWindow :: proc(hWnd: HWND) -> HWND ---
  34. SetForegroundWindow :: proc(hWnd: HWND) -> BOOL ---
  35. GetForegroundWindow :: proc() -> HWND ---
  36. UpdateWindow :: proc(hWnd: HWND) -> BOOL ---
  37. SetActiveWindow :: proc(hWnd: HWND) -> HWND ---
  38. GetActiveWindow :: proc() -> HWND ---
  39. GetMessageW :: proc(lpMsg: ^MSG, hWnd: HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT) -> BOOL ---
  40. TranslateMessage :: proc(lpMsg: ^MSG) -> BOOL ---
  41. DispatchMessageW :: proc(lpMsg: ^MSG) -> LRESULT ---
  42. PeekMessageA :: proc(lpMsg: ^MSG, hWnd: HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT, wRemoveMsg: UINT) -> BOOL ---
  43. PeekMessageW :: proc(lpMsg: ^MSG, hWnd: HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT, wRemoveMsg: UINT) -> BOOL ---
  44. PostMessageA :: proc(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> BOOL ---
  45. PostMessageW :: proc(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> BOOL ---
  46. SendMessageA :: proc(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> LRESULT ---
  47. SendMessageW :: proc(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> LRESULT ---
  48. PostThreadMessageA :: proc(idThread: DWORD, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> BOOL ---
  49. PostThreadMessageW :: proc(idThread: DWORD, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> BOOL ---
  50. PostQuitMessage :: proc(nExitCode: c_int) ---
  51. GetQueueStatus :: proc(flags: UINT) -> DWORD ---
  52. DefWindowProcA :: proc(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> LRESULT ---
  53. DefWindowProcW :: proc(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> LRESULT ---
  54. FindWindowA :: proc(lpClassName: LPCSTR, lpWindowName: LPCSTR) -> HWND ---
  55. FindWindowW :: proc(lpClassName: LPCWSTR, lpWindowName: LPCWSTR) -> HWND ---
  56. FindWindowExA :: proc(hWndParent: HWND, hWndChildAfter: HWND, lpszClass: LPCSTR, lpszWindow: LPCSTR) -> HWND ---
  57. FindWindowExW :: proc(hWndParent: HWND, hWndChildAfter: HWND, lpszClass: LPCWSTR, lpszWindow: LPCWSTR) -> HWND ---
  58. LoadIconA :: proc(hInstance: HINSTANCE, lpIconName: LPCSTR) -> HICON ---
  59. LoadIconW :: proc(hInstance: HINSTANCE, lpIconName: LPCWSTR) -> HICON ---
  60. LoadCursorA :: proc(hInstance: HINSTANCE, lpCursorName: LPCSTR) -> HCURSOR ---
  61. LoadCursorW :: proc(hInstance: HINSTANCE, lpCursorName: LPCWSTR) -> HCURSOR ---
  62. LoadImageW :: proc(hInst: HINSTANCE, name: LPCWSTR, type: UINT, cx: c_int, cy: c_int, fuLoad: UINT) -> HANDLE ---
  63. GetWindowRect :: proc(hWnd: HWND, lpRect: LPRECT) -> BOOL ---
  64. GetClientRect :: proc(hWnd: HWND, lpRect: LPRECT) -> BOOL ---
  65. ClientToScreen :: proc(hWnd: HWND, lpPoint: LPPOINT) -> BOOL ---
  66. ScreenToClient :: proc(hWnd: HWND, lpPoint: LPPOINT) -> BOOL ---
  67. SetWindowPos :: proc(
  68. hWnd: HWND,
  69. hWndInsertAfter: HWND,
  70. X: c_int,
  71. Y: c_int,
  72. cx: c_int,
  73. cy: c_int,
  74. uFlags: UINT,
  75. ) -> BOOL ---
  76. MoveWindow :: proc(hWnd: HWND, X, Y, hWidth, hHeight: c_int, bRepaint: BOOL) -> BOOL ---
  77. GetSystemMetrics :: proc(nIndex: c_int) -> c_int ---
  78. AdjustWindowRect :: proc(lpRect: LPRECT, dwStyle: DWORD, bMenu: BOOL) -> BOOL ---
  79. AdjustWindowRectEx :: proc(lpRect: LPRECT, dwStyle: DWORD, bMenu: BOOL, dwExStyle: DWORD) -> BOOL ---
  80. AdjustWindowRectExForDpi :: proc(lpRect: LPRECT, dwStyle: DWORD, bMenu: BOOL, dwExStyle: DWORD, dpi: UINT) -> BOOL ---
  81. SystemParametersInfoW :: proc(uiAction, uiParam: UINT, pvParam: PVOID, fWinIni: UINT) -> BOOL ---
  82. GetMonitorInfoW :: proc(hMonitor: HMONITOR, lpmi: LPMONITORINFO) -> BOOL ---
  83. GetWindowDC :: proc(hWnd: HWND) -> HDC ---
  84. GetDC :: proc(hWnd: HWND) -> HDC ---
  85. ReleaseDC :: proc(hWnd: HWND, hDC: HDC) -> c_int ---
  86. GetDlgCtrlID :: proc(hWnd: HWND) -> c_int ---
  87. GetDlgItem :: proc(hDlg: HWND, nIDDlgItem: c_int) -> HWND ---
  88. GetUpdateRect :: proc(hWnd: HWND, lpRect: LPRECT, bErase: BOOL) -> BOOL ---
  89. ValidateRect :: proc(hWnd: HWND, lpRect: ^RECT) -> BOOL ---
  90. InvalidateRect :: proc(hWnd: HWND, lpRect: ^RECT, bErase: BOOL) -> BOOL ---
  91. BeginPaint :: proc(hWnd: HWND, lpPaint: ^PAINTSTRUCT) -> HDC ---
  92. EndPaint :: proc(hWnd: HWND, lpPaint: ^PAINTSTRUCT) -> BOOL ---
  93. GetCapture :: proc() -> HWND ---
  94. SetCapture :: proc(hWnd: HWND) -> HWND ---
  95. ReleaseCapture :: proc() -> BOOL ---
  96. TrackMouseEvent :: proc(lpEventTrack: LPTRACKMOUSEEVENT) -> BOOL ---
  97. GetKeyState :: proc(nVirtKey: c_int) -> SHORT ---
  98. GetAsyncKeyState :: proc(vKey: c_int) -> SHORT ---
  99. GetKeyboardState :: proc(lpKeyState: PBYTE) -> BOOL ---
  100. MapVirtualKeyW :: proc(uCode: UINT, uMapType: UINT) -> UINT ---
  101. SetWindowsHookExW :: proc(idHook: c_int, lpfn: HOOKPROC, hmod: HINSTANCE, dwThreadId: DWORD) -> HHOOK ---
  102. UnhookWindowsHookEx :: proc(hhk: HHOOK) -> BOOL ---
  103. CallNextHookEx :: proc(hhk: HHOOK, nCode: c_int, wParam: WPARAM, lParam: LPARAM) -> LRESULT ---
  104. SetTimer :: proc(hWnd: HWND, nIDEvent: UINT_PTR, uElapse: UINT, lpTimerFunc: TIMERPROC) -> UINT_PTR ---
  105. KillTimer :: proc(hWnd: HWND, uIDEvent: UINT_PTR) -> BOOL ---
  106. // MessageBoxA :: proc(hWnd: HWND, lpText: LPCSTR, lpCaption: LPCSTR, uType: UINT) -> c_int ---
  107. MessageBoxW :: proc(hWnd: HWND, lpText: LPCWSTR, lpCaption: LPCWSTR, uType: UINT) -> c_int ---
  108. // MessageBoxExA :: proc(hWnd: HWND, lpText: LPCSTR, lpCaption: LPCSTR, uType: UINT, wLanguageId: WORD) -> c_int ---
  109. MessageBoxExW :: proc(hWnd: HWND, lpText: LPCWSTR, lpCaption: LPCWSTR, uType: UINT, wLanguageId: WORD) -> c_int ---
  110. ClipCursor :: proc(lpRect: LPRECT) -> BOOL ---
  111. GetCursorPos :: proc(lpPoint: LPPOINT) -> BOOL ---
  112. SetCursorPos :: proc(X: c_int, Y: c_int) -> BOOL ---
  113. SetCursor :: proc(hCursor: HCURSOR) -> HCURSOR ---
  114. EnumDisplaySettingsW :: proc(lpszDeviceName: LPCWSTR, iModeNum: DWORD, lpDevMode: ^DEVMODEW) -> BOOL ---
  115. MonitorFromPoint :: proc(pt: POINT, dwFlags: Monitor_From_Flags) -> HMONITOR ---
  116. MonitorFromRect :: proc(lprc: LPRECT, dwFlags: Monitor_From_Flags) -> HMONITOR ---
  117. MonitorFromWindow :: proc(hwnd: HWND, dwFlags: Monitor_From_Flags) -> HMONITOR ---
  118. EnumDisplayMonitors :: proc(hdc: HDC, lprcClip: LPRECT, lpfnEnum: Monitor_Enum_Proc, dwData: LPARAM) -> BOOL ---
  119. SetThreadDpiAwarenessContext :: proc(dpiContext: DPI_AWARENESS_CONTEXT) -> DPI_AWARENESS_CONTEXT ---
  120. GetThreadDpiAwarenessContext :: proc() -> DPI_AWARENESS_CONTEXT ---
  121. GetWindowDpiAwarenessContext :: proc(hwnd: HWND) -> DPI_AWARENESS_CONTEXT ---
  122. GetDpiFromDpiAwarenessContext :: proc(value: DPI_AWARENESS_CONTEXT) -> UINT ---
  123. GetDpiForWindow :: proc(hwnd: HWND) -> UINT ---
  124. SetProcessDpiAwarenessContext :: proc(value: DPI_AWARENESS_CONTEXT) -> BOOL ---
  125. BroadcastSystemMessageW :: proc(
  126. flags: DWORD,
  127. lpInfo: LPDWORD,
  128. Msg: UINT,
  129. wParam: WPARAM,
  130. lParam: LPARAM,
  131. ) -> c_long ---
  132. BroadcastSystemMessageExW :: proc(
  133. flags: DWORD,
  134. lpInfo: LPDWORD,
  135. Msg: UINT,
  136. wParam: WPARAM,
  137. lParam: LPARAM,
  138. pbsmInfo: PBSMINFO,
  139. ) -> c_long ---
  140. SendMessageTimeoutW :: proc(
  141. hWnd: HWND,
  142. Msg: UINT,
  143. wParam: WPARAM,
  144. lParam: LPARAM,
  145. fuFlags: UINT,
  146. uTimeout: UINT,
  147. lpdwResult: PDWORD_PTR,
  148. ) -> LRESULT ---
  149. GetSysColor :: proc(nIndex: c_int) -> DWORD ---
  150. GetSysColorBrush :: proc(nIndex: c_int) -> HBRUSH ---
  151. SetSysColors :: proc(cElements: c_int, lpaElements: ^INT, lpaRgbValues: ^COLORREF) -> BOOL ---
  152. MessageBeep :: proc(uType: UINT) -> BOOL ---
  153. IsDialogMessageW :: proc(hDlg: HWND, lpMsg: LPMSG) -> BOOL ---
  154. GetWindowTextLengthW :: proc(hWnd: HWND) -> c_int ---
  155. GetWindowTextW :: proc(hWnd: HWND, lpString: LPWSTR, nMaxCount: c_int) -> c_int ---
  156. SetWindowTextW :: proc(hWnd: HWND, lpString: LPCWSTR) -> BOOL ---
  157. CallWindowProcW :: proc(lpPrevWndFunc: WNDPROC, hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> LRESULT ---
  158. EnableWindow :: proc(hWnd: HWND, bEnable: BOOL) -> BOOL ---
  159. DefRawInputProc :: proc(paRawInput: ^PRAWINPUT, nInput: INT, cbSizeHeader: UINT) -> LRESULT ---
  160. GetRawInputBuffer :: proc(pRawInput: PRAWINPUT, pcbSize: PUINT, cbSizeHeader: UINT) -> UINT ---
  161. GetRawInputData :: proc(hRawInput: HRAWINPUT, uiCommand: UINT, pData: LPVOID, pcbSize: PUINT, cbSizeHeader: UINT) -> UINT ---
  162. GetRawInputDeviceInfoW :: proc(hDevice: HANDLE, uiCommand: UINT, pData: LPVOID, pcbSize: PUINT) -> UINT ---
  163. GetRawInputDeviceList :: proc(pRawInputDeviceList: PRAWINPUTDEVICELIST, puiNumDevices: PUINT, cbSize: UINT) -> UINT ---
  164. GetRegisteredRawInputDevices :: proc(pRawInputDevices: PRAWINPUTDEVICE, puiNumDevices: PUINT, cbSize: UINT) -> UINT ---
  165. RegisterRawInputDevices :: proc(pRawInputDevices: PCRAWINPUTDEVICE, uiNumDevices: UINT, cbSize: UINT) -> BOOL ---
  166. SetLayeredWindowAttributes :: proc(hWnd: HWND, crKey: COLORREF, bAlpha: BYTE, dwFlags: DWORD) -> BOOL ---
  167. FillRect :: proc(hDC: HDC, lprc: ^RECT, hbr: HBRUSH) -> int ---
  168. EqualRect :: proc(lprc1: ^RECT, lprc2: ^RECT) -> BOOL ---
  169. GetWindowInfo :: proc(hwnd: HWND, pwi: PWINDOWINFO) -> BOOL ---
  170. GetWindowPlacement :: proc(hWnd: HWND, lpwndpl: ^WINDOWPLACEMENT) -> BOOL ---
  171. SetWindowRgn :: proc(hWnd: HWND, hRgn: HRGN, bRedraw: BOOL) -> int ---
  172. CreateRectRgnIndirect :: proc(lprect: ^RECT) -> HRGN ---
  173. GetSystemMetricsForDpi :: proc(nIndex: int, dpi: UINT) -> int ---
  174. }
  175. CreateWindowW :: #force_inline proc "stdcall" (
  176. lpClassName: LPCTSTR,
  177. lpWindowName: LPCTSTR,
  178. dwStyle: DWORD,
  179. X: c_int,
  180. Y: c_int,
  181. nWidth: c_int,
  182. nHeight: c_int,
  183. hWndParent: HWND,
  184. hMenu: HMENU,
  185. hInstance: HINSTANCE,
  186. lpParam: LPVOID,
  187. ) -> HWND {
  188. return CreateWindowExW(
  189. 0,
  190. lpClassName,
  191. lpWindowName,
  192. dwStyle,
  193. X,
  194. Y,
  195. nWidth,
  196. nHeight,
  197. hWndParent,
  198. hMenu,
  199. hInstance,
  200. lpParam,
  201. )
  202. }
  203. when ODIN_ARCH == .amd64 {
  204. @(default_calling_convention="stdcall")
  205. foreign user32 {
  206. GetClassLongPtrW :: proc(hWnd: HWND, nIndex: c_int) -> ULONG_PTR ---
  207. SetClassLongPtrW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> ULONG_PTR ---
  208. GetWindowLongPtrW :: proc(hWnd: HWND, nIndex: c_int) -> LONG_PTR ---
  209. SetWindowLongPtrW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> LONG_PTR ---
  210. }
  211. } else when ODIN_ARCH == .i386 {
  212. GetClassLongPtrW :: GetClassLongW
  213. SetClassLongPtrW :: SetClassLongW
  214. GetWindowLongPtrW :: GetWindowLongW
  215. SetWindowLongPtrW :: SetWindowLongW
  216. }
  217. GET_SC_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> c_int {
  218. return c_int(wParam) & 0xFFF0
  219. }
  220. GET_WHEEL_DELTA_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> c_short {
  221. return cast(c_short)HIWORD(cast(DWORD)wParam)
  222. }
  223. GET_KEYSTATE_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> WORD {
  224. return LOWORD(cast(DWORD)wParam)
  225. }
  226. GET_NCHITTEST_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> c_short {
  227. return cast(c_short)LOWORD(cast(DWORD)wParam)
  228. }
  229. GET_XBUTTON_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> WORD {
  230. return HIWORD(cast(DWORD)wParam)
  231. }
  232. MAKEINTRESOURCEW :: #force_inline proc "contextless" (#any_int i: int) -> LPWSTR {
  233. return cast(LPWSTR)uintptr(WORD(i))
  234. }
  235. Monitor_From_Flags :: enum DWORD {
  236. MONITOR_DEFAULTTONULL = 0x00000000, // Returns NULL
  237. MONITOR_DEFAULTTOPRIMARY = 0x00000001, // Returns a handle to the primary display monitor
  238. MONITOR_DEFAULTTONEAREST = 0x00000002, // Returns a handle to the display monitor that is nearest to the window
  239. }
  240. Monitor_Enum_Proc :: #type proc "stdcall" (HMONITOR, HDC, LPRECT, LPARAM) -> BOOL
  241. USER_DEFAULT_SCREEN_DPI :: 96
  242. DPI_AWARENESS_CONTEXT :: distinct HANDLE
  243. DPI_AWARENESS_CONTEXT_UNAWARE :: DPI_AWARENESS_CONTEXT(~uintptr(0)) // -1
  244. DPI_AWARENESS_CONTEXT_SYSTEM_AWARE :: DPI_AWARENESS_CONTEXT(~uintptr(1)) // -2
  245. DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE :: DPI_AWARENESS_CONTEXT(~uintptr(2)) // -3
  246. DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 :: DPI_AWARENESS_CONTEXT(~uintptr(3)) // -4
  247. DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED :: DPI_AWARENESS_CONTEXT(~uintptr(4)) // -5
  248. RAWINPUTHEADER :: struct {
  249. dwType: DWORD,
  250. dwSize: DWORD,
  251. hDevice: HANDLE,
  252. wParam: WPARAM,
  253. }
  254. RAWHID :: struct {
  255. dwSizeHid: DWORD,
  256. dwCount: DWORD,
  257. bRawData: [1]BYTE,
  258. }
  259. RAWMOUSE :: struct {
  260. usFlags: USHORT,
  261. DUMMYUNIONNAME: struct #raw_union {
  262. ulButtons: ULONG,
  263. DUMMYSTRUCTNAME: struct {
  264. usButtonFlags: USHORT,
  265. usButtonData: USHORT,
  266. },
  267. },
  268. ulRawButtons: ULONG,
  269. lLastX: LONG,
  270. lLastY: LONG,
  271. ulExtraInformation: ULONG,
  272. }
  273. RAWKEYBOARD :: struct {
  274. MakeCode: USHORT,
  275. Flags: USHORT,
  276. Rserved: USHORT,
  277. VKey: USHORT,
  278. Message: UINT,
  279. ExtraInformation: ULONG,
  280. }
  281. RAWINPUT :: struct {
  282. header: RAWINPUTHEADER,
  283. data: struct #raw_union {
  284. mouse: RAWMOUSE,
  285. keyboard: RAWKEYBOARD,
  286. hid: RAWHID,
  287. },
  288. }
  289. PRAWINPUT :: ^RAWINPUT
  290. HRAWINPUT :: distinct LPARAM
  291. RAWINPUTDEVICE :: struct {
  292. usUsagePage: USHORT,
  293. usUsage: USHORT,
  294. dwFlags: DWORD,
  295. hwndTarget: HWND,
  296. }
  297. PRAWINPUTDEVICE :: ^RAWINPUTDEVICE
  298. PCRAWINPUTDEVICE :: PRAWINPUTDEVICE
  299. RAWINPUTDEVICELIST :: struct {
  300. hDevice: HANDLE,
  301. dwType: DWORD,
  302. }
  303. PRAWINPUTDEVICELIST :: ^RAWINPUTDEVICELIST
  304. RID_DEVICE_INFO_HID :: struct {
  305. dwVendorId: DWORD,
  306. dwProductId: DWORD,
  307. dwVersionNumber: DWORD,
  308. usUsagePage: USHORT,
  309. usUsage: USHORT,
  310. }
  311. RID_DEVICE_INFO_KEYBOARD :: struct {
  312. dwType: DWORD,
  313. dwSubType: DWORD,
  314. dwKeyboardMode: DWORD,
  315. dwNumberOfFunctionKeys: DWORD,
  316. dwNumberOfIndicators: DWORD,
  317. dwNumberOfKeysTotal: DWORD,
  318. }
  319. RID_DEVICE_INFO_MOUSE :: struct {
  320. dwId: DWORD,
  321. dwNumberOfButtons: DWORD,
  322. dwSampleRate: DWORD,
  323. fHasHorizontalWheel: BOOL,
  324. }
  325. RID_DEVICE_INFO :: struct {
  326. cbSize: DWORD,
  327. dwType: DWORD,
  328. DUMMYUNIONNAME: struct #raw_union {
  329. mouse: RID_DEVICE_INFO_MOUSE,
  330. keyboard: RID_DEVICE_INFO_KEYBOARD,
  331. hid: RID_DEVICE_INFO_HID,
  332. },
  333. }
  334. RIDEV_REMOVE :: 0x00000001
  335. RIDEV_EXCLUDE :: 0x00000010
  336. RIDEV_PAGEONLY :: 0x00000020
  337. RIDEV_NOLEGACY :: 0x00000030
  338. RIDEV_INPUTSINK :: 0x00000100
  339. RIDEV_CAPTUREMOUSE :: 0x00000200
  340. RIDEV_NOHOTKEYS :: 0x00000200
  341. RIDEV_APPKEYS :: 0x00000400
  342. RIDEV_EXINPUTSINK :: 0x00001000
  343. RIDEV_DEVNOTIFY :: 0x00002000
  344. RID_HEADER :: 0x10000005
  345. RID_INPUT :: 0x10000003
  346. RIM_TYPEMOUSE :: 0
  347. RIM_TYPEKEYBOARD :: 1
  348. RIM_TYPEHID :: 2
  349. MOUSE_MOVE_RELATIVE :: 0x00
  350. MOUSE_MOVE_ABSOLUTE :: 0x01
  351. MOUSE_VIRTUAL_DESKTOP :: 0x02
  352. MOUSE_ATTRIUBTTES_CHANGED :: 0x04
  353. MOUSE_MOVE_NOCOALESCE :: 0x08
  354. RI_MOUSE_BUTTON_1_DOWN :: 0x0001
  355. RI_MOUSE_LEFT_BUTTON_DOWNS :: RI_MOUSE_BUTTON_1_DOWN
  356. RI_MOUSE_BUTTON_1_UP :: 0x0002
  357. RI_MOUSE_LEFT_BUTTON_UP :: RI_MOUSE_BUTTON_1_UP
  358. RI_MOUSE_BUTTON_2_DOWN :: 0x0004
  359. RI_MOUSE_RIGHT_BUTTON_DOWN :: RI_MOUSE_BUTTON_2_DOWN
  360. RI_MOUSE_BUTTON_2_UP :: 0x0008
  361. RI_MOUSE_RIGHT_BUTTON_UP :: RI_MOUSE_BUTTON_2_UP
  362. RI_MOUSE_BUTTON_3_DOWN :: 0x0010
  363. RI_MOUSE_MIDDLE_BUTTON_DOWN :: RI_MOUSE_BUTTON_3_DOWN
  364. RI_MOUSE_BUTTON_3_UP :: 0x0020
  365. RI_MOUSE_MIDDLE_BUTTON_UP :: RI_MOUSE_BUTTON_3_UP
  366. RI_MOUSE_BUTTON_4_DOWN :: 0x0040
  367. RI_MOUSE_BUTTON_4_UP :: 0x0080
  368. RI_MOUSE_BUTTON_5_DOWN :: 0x0100
  369. RI_MOUSE_BUTTON_5_UP :: 0x0200
  370. RI_MOUSE_WHEEL :: 0x0400
  371. RI_MOUSE_HWHEEL :: 0x0800
  372. WINDOWPLACEMENT :: struct {
  373. length: UINT,
  374. flags: UINT,
  375. showCmd: UINT,
  376. ptMinPosition: POINT,
  377. ptMaxPosition: POINT,
  378. rcNormalPosition: RECT,
  379. rcDevice: RECT,
  380. }
  381. WINDOWINFO :: struct {
  382. cbSize: DWORD,
  383. rcWindow: RECT,
  384. rcClient: RECT,
  385. dwStyle: DWORD,
  386. dwExStyle: DWORD,
  387. dwWindowStatus: DWORD,
  388. cxWindowBorders: UINT,
  389. cyWindowBorders: UINT,
  390. atomWindowType: ATOM,
  391. wCreatorVersion: WORD,
  392. }
  393. PWINDOWINFO :: ^WINDOWINFO