I'd like to use the IDE's intellisense to list all that functions.
like Win::Sendmessage()
One time I saw the List of integerated API's anywhere in the PB folder. But I could not find it again.
So I had the idea to try ChatGPT to generate me an WinAPI Module. Seems to be ChatCPT learnd a lot.
Can anyone tell me where to find this list for all OS!
I'd like to integegrate all PB included API's for all OS
Here the WinAPI Module.
Code: Select all
; created with the help of ChatGPT
; V0.1
; 2026/02/12
DeclareModule WIN
; ======================================================
; KERNEL32 – Core / Memory / Process / File
; ======================================================
; Retrieves calling thread's last-error code.
; Returns: DWORD error code
Macro GetLastError()
GetLastError_()
EndMacro
; Sets calling thread's last-error code.
; code = DWORD error value
Macro SetLastError(code)
SetLastError_(code)
EndMacro
; Retrieves module handle.
; name = Module name (NULL for current process)
; Returns: HMODULE
Macro GetModuleHandle(name)
GetModuleHandle_(name)
EndMacro
; Loads a DLL into process.
; name = DLL filename
; Returns: HMODULE
Macro LoadLibrary(name)
LoadLibrary_(name)
EndMacro
; Frees loaded DLL.
; hLib = module handle
; Returns: BOOL
Macro FreeLibrary(hLib)
FreeLibrary_(hLib)
EndMacro
; Creates new process.
; app = executable path
; cmd = command line
; pattr = process security attributes
; tattr = thread security attributes
; inherit = inherit handles (BOOL)
; flags = creation flags
; env = environment block
; dir = working directory
; startup = pointer to STARTUPINFO
; procinfo = pointer to PROCESS_INFORMATION
; Returns: BOOL
Macro CreateProcess(app, cmd, pattr, tattr, inherit, flags, env, dir, startup, procinfo)
CreateProcess_(app, cmd, pattr, tattr, inherit, flags, env, dir, startup, procinfo)
EndMacro
; Terminates current process.
; code = exit code
Macro ExitProcess(code)
ExitProcess_(code)
EndMacro
; Returns current process ID.
Macro GetCurrentProcessId()
GetCurrentProcessId_()
EndMacro
; Creates thread.
; attr = security attributes
; stack = stack size
; start = thread function pointer
; param = parameter pointer
; flags = creation flags
; tid = receives thread ID
; Returns: thread handle
Macro CreateThread(attr, stack, start, param, flags, tid)
CreateThread_(attr, stack, start, param, flags, tid)
EndMacro
; Waits for object signal.
; handle = object handle
; timeout = milliseconds
; Returns: wait result code
Macro WaitForSingleObject(handle, timeout)
WaitForSingleObject_(handle, timeout)
EndMacro
; Closes open handle.
; handle = object handle
; Returns: BOOL
Macro CloseHandle(handle)
CloseHandle_(handle)
EndMacro
; Allocates global memory.
; flags = GMEM flags
; size = bytes to allocate
; Returns: HGLOBAL
Macro GlobalAlloc(flags, size)
GlobalAlloc_(flags, size)
EndMacro
; Frees global memory.
; mem = HGLOBAL
Macro GlobalFree(mem)
GlobalFree_(mem)
EndMacro
; Allocates virtual memory.
; addr = desired address (or NULL)
; size = size in bytes
; type = MEM_COMMIT/MEM_RESERVE
; protect = memory protection flags
; Returns: pointer
Macro VirtualAlloc(addr, size, type, protect)
VirtualAlloc_(addr, size, type, protect)
EndMacro
; Frees virtual memory.
; addr = base address
; size = size
; type = MEM_RELEASE/MEM_DECOMMIT
Macro VirtualFree(addr, size, type)
VirtualFree_(addr, size, type)
EndMacro
; Copies memory block.
; dest = destination pointer
; src = source pointer
; size = number of bytes
Macro CopyMemory(dest, src, size)
CopyMemory_(src, dest, size)
EndMacro
; Creates or opens file.
; name = filename
; access = GENERIC_READ/WRITE
; share = share mode
; sec = security attributes
; creation = creation disposition
; flags = attributes/flags
; template = template file handle
; Returns: file handle
Macro CreateFile(name, access, share, sec, creation, flags, template)
CreateFile_(name, access, share, sec, creation, flags, template)
EndMacro
; Reads file.
; file = file handle
; buffer = pointer to buffer
; toread = bytes to read
; read = receives bytes read
; overlapped = overlapped struct
Macro ReadFile(file, buffer, toread, Read, overlapped)
ReadFile_(file, buffer, toread, Read, overlapped)
EndMacro
; Writes file.
; file = file handle
; buffer = data pointer
; towrite = bytes to write
; written = receives bytes written
; overlapped = overlapped struct
Macro WriteFile(file, buffer, towrite, written, overlapped)
WriteFile_(file, buffer, towrite, written, overlapped)
EndMacro
; Deletes file.
; name = filename
Macro DeleteFile(name)
DeleteFile_(name)
EndMacro
; Suspends execution.
; ms = milliseconds
Macro Sleep(ms)
Sleep_(ms)
EndMacro
; Returns system uptime in ms.
Macro GetTickCount()
GetTickCount_()
EndMacro
; ======================================================
; USER32 – Windows / Messaging
; ======================================================
; Sends message (blocking).
; hWnd = target window handle
; Msg = message ID
; wParam = WPARAM
; lParam = LPARAM
Macro SendMessage(hWnd, Msg, wParam, lParam)
SendMessage_(hWnd, Msg, wParam, lParam)
EndMacro
; Posts message (non-blocking).
Macro PostMessage(hWnd, Msg, wParam, lParam)
PostMessage_(hWnd, Msg, wParam, lParam)
EndMacro
; Shows/hides window.
; cmd = SW_SHOW, SW_HIDE, etc.
Macro ShowWindow(hWnd, cmd)
ShowWindow_(hWnd, cmd)
EndMacro
; Sets window text.
; txt = new caption
Macro SetWindowText(hWnd, txt)
SetWindowText_(hWnd, txt)
EndMacro
; Displays message box.
; text = message
; caption = title
; type = MB_* flags
Macro MessageBox(hWnd, text, caption, type)
MessageBox_(hWnd, text, caption, type)
EndMacro
; Loads system cursor.
; inst = instance (NULL for system)
; name = IDC_* identifier
Macro LoadCursor(inst, name)
LoadCursor_(inst, name)
EndMacro
; Retrieves async key state.
; key = virtual key code
Macro GetAsyncKeyState(key)
GetAsyncKeyState_(key)
EndMacro
; ======================================================
; GDI32 – Graphics
; ======================================================
; Retrieves device context.
; hWnd = window handle
Macro GetDC(hWnd)
GetDC_(hWnd)
EndMacro
; Releases device context.
Macro ReleaseDC(hWnd, hDC)
ReleaseDC_(hWnd, hDC)
EndMacro
; Performs bit-block transfer.
; destDC = destination DC
; x,y = dest position
; w,h = size
; srcDC = source DC
; sx,sy = source position
; rop = raster operation
Macro BitBlt(destDC, x, y, w, h, srcDC, sx, sy, rop)
BitBlt_(destDC, x, y, w, h, srcDC, sx, sy, rop)
EndMacro
; ======================================================
; ADVAPI32 – Registry
; ======================================================
; Opens registry key.
; hKey = root key
; subkey = subkey string
; sam = security access mask
; result = receives key handle
Macro RegOpenKeyEx(hKey, subkey, opt, sam, result)
RegOpenKeyEx_(hKey, subkey, opt, sam, result)
EndMacro
; Sets registry value.
; name = value name
; type = REG_* type
; data = pointer to data
; size = data size
Macro RegSetValueEx(hKey, name, res, type, Data, size)
RegSetValueEx_(hKey, name, res, type, Data, size)
EndMacro
; Closes registry key.
Macro RegCloseKey(hKey)
RegCloseKey_(hKey)
EndMacro
; ======================================================
; SHELL32
; ======================================================
; Executes file/application.
; op = operation ("open")
; file = filename
; params = parameters
; dir = working directory
; show = SW_* flag
Macro ShellExecute(hWnd, op, file, params, dir, show)
ShellExecute_(hWnd, op, file, params, dir, show)
EndMacro
EndDeclareModule
Module Win
EnableExplicit
EndModule

