'==============================================================================
' User32 API Declares for PBXA64
' Window management, message boxes, input functions
' (C) 2026 Theo Gottwald / www.smart-package.com
'==============================================================================

' --- MessageBox ---

DECLARE FUNCTION MessageBoxA LIB "user32.dll" ALIAS "MessageBoxA" ( _
    BYVAL hWnd AS QUAD, _
    BYVAL lpText AS ASCIIZ PTR, _
    BYVAL lpCaption AS ASCIIZ PTR, _
    BYVAL uType AS DWORD _
) AS LONG

DECLARE FUNCTION MessageBoxW LIB "user32.dll" ALIAS "MessageBoxW" ( _
    BYVAL hWnd AS QUAD, _
    BYVAL lpText AS WSTRING, _
    BYVAL lpCaption AS WSTRING, _
    BYVAL uType AS DWORD _
) AS LONG

' --- Window ---

DECLARE FUNCTION FindWindowA LIB "user32.dll" ALIAS "FindWindowA" ( _
    BYVAL lpClassName AS QUAD, _
    BYVAL lpWindowName AS ASCIIZ PTR _
) AS QUAD

DECLARE FUNCTION FindWindowW LIB "user32.dll" ALIAS "FindWindowW" ( _
    BYVAL lpClassName AS QUAD, _
    BYVAL lpWindowName AS WSTRING _
) AS QUAD

DECLARE FUNCTION SetWindowTextA LIB "user32.dll" ALIAS "SetWindowTextA" ( _
    BYVAL hWnd AS QUAD, _
    BYVAL lpString AS ASCIIZ PTR _
) AS LONG

DECLARE FUNCTION GetWindowTextA LIB "user32.dll" ALIAS "GetWindowTextA" ( _
    BYVAL hWnd AS QUAD, _
    BYVAL lpString AS ASCIIZ PTR, _
    BYVAL nMaxCount AS LONG _
) AS LONG

DECLARE FUNCTION GetWindowTextLengthA LIB "user32.dll" ALIAS "GetWindowTextLengthA" ( _
    BYVAL hWnd AS QUAD _
) AS LONG

DECLARE FUNCTION SetForegroundWindow LIB "user32.dll" ALIAS "SetForegroundWindow" ( _
    BYVAL hWnd AS QUAD _
) AS LONG

DECLARE FUNCTION GetForegroundWindow LIB "user32.dll" ALIAS "GetForegroundWindow" () AS QUAD

DECLARE FUNCTION ShowWindow LIB "user32.dll" ALIAS "ShowWindow" ( _
    BYVAL hWnd AS QUAD, _
    BYVAL nCmdShow AS LONG _
) AS LONG

DECLARE FUNCTION IsWindowVisible LIB "user32.dll" ALIAS "IsWindowVisible" ( _
    BYVAL hWnd AS QUAD _
) AS LONG

DECLARE FUNCTION EnableWindow LIB "user32.dll" ALIAS "EnableWindow" ( _
    BYVAL hWnd AS QUAD, _
    BYVAL bEnable AS LONG _
) AS LONG

DECLARE FUNCTION DestroyWindow LIB "user32.dll" ALIAS "DestroyWindow" ( _
    BYVAL hWnd AS QUAD _
) AS LONG

' --- System ---

DECLARE FUNCTION GetSystemMetrics LIB "user32.dll" ALIAS "GetSystemMetrics" ( _
    BYVAL nIndex AS LONG _
) AS LONG

DECLARE FUNCTION SystemParametersInfoA LIB "user32.dll" ALIAS "SystemParametersInfoA" ( _
    BYVAL uAction AS DWORD, _
    BYVAL uParam AS DWORD, _
    BYVAL lpvParam AS QUAD, _
    BYVAL fuWinIni AS DWORD _
) AS LONG

' --- Input ---

DECLARE FUNCTION GetAsyncKeyState LIB "user32.dll" ALIAS "GetAsyncKeyState" ( _
    BYVAL vKey AS LONG _
) AS INTEGER

DECLARE FUNCTION GetKeyState LIB "user32.dll" ALIAS "GetKeyState" ( _
    BYVAL nVirtKey AS LONG _
) AS INTEGER

DECLARE FUNCTION keybd_event LIB "user32.dll" ALIAS "keybd_event" ( _
    BYVAL bVk AS BYTE, _
    BYVAL bScan AS BYTE, _
    BYVAL dwFlags AS DWORD, _
    BYVAL dwExtraInfo AS QUAD _
)

' --- Clipboard ---

DECLARE FUNCTION OpenClipboard LIB "user32.dll" ALIAS "OpenClipboard" ( _
    BYVAL hWndNewOwner AS QUAD _
) AS LONG

DECLARE FUNCTION CloseClipboard LIB "user32.dll" ALIAS "CloseClipboard" () AS LONG

DECLARE FUNCTION EmptyClipboard LIB "user32.dll" ALIAS "EmptyClipboard" () AS LONG

DECLARE FUNCTION GetClipboardData LIB "user32.dll" ALIAS "GetClipboardData" ( _
    BYVAL uFormat AS DWORD _
) AS QUAD

DECLARE FUNCTION SetClipboardData LIB "user32.dll" ALIAS "SetClipboardData" ( _
    BYVAL uFormat AS DWORD, _
    BYVAL hMem AS QUAD _
) AS QUAD

' --- Registry (via advapi32 but commonly used with UI) ---

DECLARE FUNCTION RegOpenKeyExA LIB "advapi32.dll" ALIAS "RegOpenKeyExA" ( _
    BYVAL hKey AS QUAD, _
    BYVAL lpSubKey AS ASCIIZ PTR, _
    BYVAL ulOptions AS DWORD, _
    BYVAL samDesired AS DWORD, _
    BYREF phkResult AS QUAD _
) AS LONG

DECLARE FUNCTION RegCloseKey LIB "advapi32.dll" ALIAS "RegCloseKey" ( _
    BYVAL hKey AS QUAD _
) AS LONG

DECLARE FUNCTION RegQueryValueExA LIB "advapi32.dll" ALIAS "RegQueryValueExA" ( _
    BYVAL hKey AS QUAD, _
    BYVAL lpValueName AS ASCIIZ PTR, _
    BYVAL lpReserved AS QUAD, _
    BYREF lpType AS DWORD, _
    BYVAL lpData AS ASCIIZ PTR, _
    BYREF lpcbData AS DWORD _
) AS LONG

' --- Common String Helpers (kernel32 exports commonly used with UI) ---

DECLARE FUNCTION lstrlenA LIB "kernel32.dll" ALIAS "lstrlenA" ( _
    BYVAL lpString AS ASCIIZ PTR _
) AS LONG

DECLARE FUNCTION lstrcpynA LIB "kernel32.dll" ALIAS "lstrcpynA" ( _
    BYVAL lpString1 AS ASCIIZ PTR, _
    BYVAL lpString2 AS ASCIIZ PTR, _
    BYVAL iMaxLength AS LONG _
) AS QUAD

DECLARE FUNCTION wsprintfA LIB "user32.dll" ALIAS "wsprintfA" ( _
    BYVAL lpOutput AS ASCIIZ PTR, _
    BYVAL lpFormat AS ASCIIZ PTR _
) AS LONG
