Browse Source

Merge pull request #1668 from ftphikari/master

sys/windows: add SetTimer() and KillTimer() procedures
Jeroen van Rijn 3 years ago
parent
commit
085fa199ea
2 changed files with 8 additions and 0 deletions
  1. 5 0
      core/sys/windows/types.odin
  2. 3 0
      core/sys/windows/user32.odin

+ 5 - 0
core/sys/windows/types.odin

@@ -194,6 +194,8 @@ GetFileExInfoStandard: GET_FILEEX_INFO_LEVELS : 0
 GetFileExMaxInfoLevel: GET_FILEEX_INFO_LEVELS : 1
 
 
+TIMERPROC :: #type proc "stdcall" (HWND, UINT, UINT_PTR, DWORD)
+
 WNDPROC :: #type proc "stdcall" (HWND, UINT, WPARAM, LPARAM) -> LRESULT
 
 WNDCLASSA :: struct {
@@ -618,6 +620,9 @@ MK_MBUTTON  :: 0x0010
 MK_XBUTTON1 :: 0x0020
 MK_XBUTTON2 :: 0x0040
 
+USER_TIMER_MAXIMUM :: 0x7FFFFFFF
+USER_TIMER_MINIMUM :: 0x0000000A
+
 _IDC_APPSTARTING := rawptr(uintptr(32650))
 _IDC_ARROW       := rawptr(uintptr(32512))
 _IDC_CROSS       := rawptr(uintptr(32515))

+ 3 - 0
core/sys/windows/user32.odin

@@ -126,6 +126,9 @@ foreign user32 {
 	GetKeyState :: proc(nVirtKey: c_int) -> SHORT ---
 	GetAsyncKeyState :: proc(vKey: c_int) -> SHORT ---
 
+	SetTimer :: proc(hWnd: HWND, nIDEvent: UINT_PTR, uElapse: UINT, lpTimerFunc: TIMERPROC) -> UINT_PTR ---
+	KillTimer :: proc(hWnd: HWND, uIDEvent: UINT_PTR) -> BOOL ---
+
 	MessageBoxA :: proc(hWnd: HWND, lpText: LPCSTR, lpCaption: LPCSTR, uType: UINT) -> c_int ---
 	MessageBoxW :: proc(hWnd: HWND, lpText: LPCWSTR, lpCaption: LPCWSTR, uType: UINT) -> c_int ---
 	MessageBoxExA :: proc(hWnd: HWND, lpText: LPCSTR, lpCaption: LPCSTR, uType: UINT, wLanguageId: WORD) -> c_int ---