RAS standard library
Win32 API (win32)
Declarations for commonly used Win32 APIs. When you import them, as in import { Sleep } from "win32";, only the declarations you use are emitted, as Declare statements (#If VBA7) that work in both 32-bit and 64-bit Office. Functions in other DLLs can be declared yourself with declare module (specification §11).
import { Sleep } from "win32";
export function waitASecond() {
Sleep(1000);
}
Reference
Function Sleep
function Sleep(dwMilliseconds: int): void
Suspends the current thread for the given number of milliseconds.
Function GetTickCount
function GetTickCount(): int
Milliseconds since the system started (wraps around after about 49.7 days).
Function GetTickCount64
function GetTickCount64(): long
Milliseconds since the system started (64-bit; 64-bit Office only).
Function GetCurrentProcessId
function GetCurrentProcessId(): int
The current process ID.
Function CopyMemory
@alias("RtlMoveMemory") export function CopyMemory(byref destination: any, byref source: any, length: ptr): void
Copies a block of memory (RtlMoveMemory).
Function QueryPerformanceCounter
function QueryPerformanceCounter(byref lpPerformanceCount: currency): int
Current value of the high-resolution performance counter.
Function QueryPerformanceFrequency
function QueryPerformanceFrequency(byref lpFrequency: currency): int
Frequency of the high-resolution performance counter.
Function GetForegroundWindow
function GetForegroundWindow(): ptr
Handle of the foreground window.
Function GetWindowText
@alias("GetWindowTextW") export function GetWindowText(hWnd: ptr, lpString: wstr, nMaxCount: int): int
Gets the title of a window.
Function FindWindow
@alias("FindWindowW") export function FindWindow(lpClassName: wstr, lpWindowName: wstr): ptr
Finds a window by class name and window name.
Function SetForegroundWindow
function SetForegroundWindow(hWnd: ptr): int
Brings a window to the foreground.
Function GetAsyncKeyState
function GetAsyncKeyState(vKey: int): short
Gets the state of a key.