RAS標準ライブラリ
Win32 API(win32)
よく使う Win32 API の宣言です。import { Sleep } from "win32"; のように取り込むと、使った宣言だけが 32bit / 64bit の両方の Office で動く Declare(#If VBA7)として出力されます。ほかの DLL の関数は declare module で自分で宣言できます(仕様書 §11)。
import { Sleep } from "win32";
export function waitASecond() {
Sleep(1000);
}
リファレンス
関数 Sleep
function Sleep(dwMilliseconds: int): void
指定したミリ秒だけ現在のスレッドを停止する。
関数 GetTickCount
function GetTickCount(): int
システム起動からの経過ミリ秒(約 49.7 日で折り返す)。
関数 GetTickCount64
function GetTickCount64(): long
システム起動からの経過ミリ秒(64bit。64bit Office 専用)。
関数 GetCurrentProcessId
function GetCurrentProcessId(): int
現在のプロセス ID。
関数 CopyMemory
@alias("RtlMoveMemory") export function CopyMemory(byref destination: any, byref source: any, length: ptr): void
メモリブロックをコピーする(RtlMoveMemory)。
関数 QueryPerformanceCounter
function QueryPerformanceCounter(byref lpPerformanceCount: currency): int
高分解能カウンタの現在値。
関数 QueryPerformanceFrequency
function QueryPerformanceFrequency(byref lpFrequency: currency): int
高分解能カウンタの周波数。
関数 GetForegroundWindow
function GetForegroundWindow(): ptr
最前面のウィンドウのハンドル。
関数 GetWindowText
@alias("GetWindowTextW") export function GetWindowText(hWnd: ptr, lpString: wstr, nMaxCount: int): int
ウィンドウのタイトルを取得する。
関数 FindWindow
@alias("FindWindowW") export function FindWindow(lpClassName: wstr, lpWindowName: wstr): ptr
クラス名・ウィンドウ名からウィンドウを探す。
関数 SetForegroundWindow
function SetForegroundWindow(hWnd: ptr): int
ウィンドウを最前面にする。
関数 GetAsyncKeyState
function GetAsyncKeyState(vKey: int): short
キーの状態を取得する。