Improved win32 bindings according to Kelimions suggestions with enums and bitsets

This commit is contained in:
Franz Höltermann
2024-06-14 16:32:41 +02:00
parent c6c00c706a
commit ec7b77fc0f
2 changed files with 29 additions and 4 deletions

View File

@@ -1214,13 +1214,28 @@ SYSTEM_LOGICAL_PROCESSOR_INFORMATION :: struct {
}
SYSTEM_POWER_STATUS :: struct {
ACLineStatus: BYTE,
BatteryFlag: BYTE,
ACLineStatus: AC_Line_Status,
BatteryFlag: Battery_Flags,
BatteryLifePercent: BYTE,
SystemStatusFlag: BYTE,
BatteryLifeTime: DWORD,
BatteryFullLifeTime: DWORD,
}
}
AC_Line_Status :: enum BYTE {
Offline = 0,
Online = 1,
Unknown = 255,
}
Battery_Flag :: enum BYTE {
High = 0,
Low = 1,
Critical = 2,
Charging = 3,
No_Battery = 7,
}
Battery_Flags :: bit_set[Battery_Flag; BYTE]
/* Global Memory Flags */
GMEM_FIXED :: 0x0000

View File

@@ -23,7 +23,8 @@ foreign user32 {
eventMin, eventMax: DWORD,
hmodWinEventProc: HMODULE,
pfnWinEvenProc: WINEVENTPROC,
idProcess, idThread, dwmFlags: DWORD,
idProcess, idThread: DWORD,
dwFlags: WinEventFlags,
) -> HWINEVENTHOOK ---
IsChild :: proc(hWndParent, hWnd: HWND) -> BOOL ---
@@ -579,3 +580,12 @@ RedrawWindowFlags :: enum UINT {
RDW_FRAME = 0x0400,
RDW_NOFRAME = 0x0800,
}
WinEventFlags :: bit_set[WinEventFlag; DWORD]
WinEventFlag :: enum DWORD {
WINEVENT_OUTOFCONTEXT = 0,
WINEVENT_SKIPOWNTHREAD = 1,
WINEVENT_SKIPOWNPROCESS = 2,
WINEVENT_INCONTEXT = 4,
}