UNPKG

win32-api

Version:

FFI definitions of windows win32 api for node-ffi

122 lines (109 loc) 5.59 kB
import { LibUser32 } from '##/lib/user32/index.js'; import { DOC_INFO_1_Type, EnumPrinters_Level as EnumPrinters_Level$1, EnumPrinters_Level_X_Type, PRINTER_INFO_LEVEL as PRINTER_INFO_LEVEL$1, PRINTER_INFO_X_Type } from 'win32-def/struct'; import { EnumPrinters_Level, PRINTER_INFO_LEVEL, HANDLE, HWND } from 'win32-def/types'; declare const fnAsyncName$2: keyof LibUser32; type FnType$2 = LibUser32[typeof fnAsyncName$2]; type RetType$1 = ReturnType<FnType$2>; type ParamType$2 = Parameters<FnType$2>; /** * Retrieves a handle to a window whose class name and window name match the specified strings. * The function searches child windows, beginning with the one following the specified child window. * This function does not perform a case-sensitive search. * @link https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-findwindowexw * * 检索其类名和窗口名称与指定字符串匹配的窗口的句柄。 函数搜索子窗口,从指定子窗口后面的子窗口开始。 此函数不执行区分大小写的搜索。 * @link https://learn.microsoft.com/zh-cn/windows/win32/api/winuser/nf-winuser-findwindowexw */ declare function FindWindowEx(hwndParent: ParamType$2[0], hwndChildAfter: ParamType$2[1], lpszClass: ParamType$2[2], lpszWindow: ParamType$2[3]): Promise<RetType$1>; declare const fnAsyncName$1: keyof LibUser32; type FnType$1 = LibUser32[typeof fnAsyncName$1]; type ParamType$1 = Parameters<FnType$1>; /** * Retrieves a handle to a window whose class name and window name match the specified strings. * The function searches child windows, beginning with the one following the specified child window. * This function does not perform a case-sensitive search. * @link https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getwindowtextw * * 检索其类名和窗口名称与指定字符串匹配的窗口的句柄。 函数搜索子窗口,从指定子窗口后面的子窗口开始。 此函数不执行区分大小写的搜索。 * @link https://learn.microsoft.com/zh-cn/windows/win32/api/winuser/nf-winuser-getwindowtextw */ declare function GetWindowText(hWnd: ParamType$1[0], nMaxCount: ParamType$1[2]): Promise<string>; declare const fnAsyncName: keyof LibUser32; type FnType = LibUser32[typeof fnAsyncName]; type RetType = ReturnType<FnType>; type ParamType = Parameters<FnType>; interface MessageBoxOptions { hWnd: ParamType[0]; lpText: ParamType[1]; lpCaption: ParamType[2]; uType: ParamType[3]; wLanguageId: ParamType[4]; } /** https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messageboxexw */ declare function MessageBox(options: MessageBoxOptions): RetType; interface EnumPrintersOptions<Level extends EnumPrinters_Level> { Level: Level; /** * PrinterEnumFlags * @see https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rprn/2a1fe8a4-e8be-4cf3-8b37-8d19f9a2edcd */ Flags: number; Name?: string; /** * @default 4096 */ cbBuf?: number; } interface GetPrinterOptions<Level extends PRINTER_INFO_LEVEL> { hPrinter: HANDLE; Level: Level; /** * @default 1024 */ maxLength?: number; } interface StartDocPrinterOptions { hPrinter: HANDLE; pDocInfo: DOC_INFO_1_Type; } /** * @link https://learn.microsoft.com/zh-cn/windows/win32/printdocs/closeprinter */ declare function ClosePrinter(hwnd: HWND): Promise<boolean>; /** * @link https://learn.microsoft.com/zh-cn/windows/win32/printdocs/EndDocPrinter */ declare function EndDocPrinter(hwnd: HWND): Promise<boolean>; /** * Enumerates available printers, print servers, domains, or print providers. * @link https://learn.microsoft.com/en-us/windows/win32/printdocs/enumprinters * * 枚举可用的打印机、打印服务器、域或打印提供程序 * @link https://learn.microsoft.com/zh-cn/windows/win32/printdocs/enumprinters */ declare function EnumPrinters<Level extends EnumPrinters_Level$1>(options: EnumPrintersOptions<Level>): Promise<EnumPrinters_Level_X_Type<Level>[]>; /** * @link https://learn.microsoft.com/en-us/windows/win32/printdocs/getdefaultprinter */ declare function GetDefaultPrinter(maxNameLength?: number): Promise<string | null>; /** * @link https://learn.microsoft.com/zh-cn/windows/win32/printdocs/getprinter */ declare function GetPrinter<Level extends PRINTER_INFO_LEVEL$1>(options: GetPrinterOptions<Level>): Promise<PRINTER_INFO_X_Type<Level> | null>; /** * Retrieves a handle to the specified printer or print server or other types of handles in the print subsystem * @link https://learn.microsoft.com/en-us/windows/win32/printdocs/openprinter * * 检索指定打印机或打印服务器或打印子系统中其他类型的句柄的句柄 * @link https://learn.microsoft.com/zh-cn/windows/win32/printdocs/openprinter */ declare function OpenPrinter(printerName: string): Promise<HWND | null>; /** * Notifies the print spooler that a document is to be spooled for printing * @link https://learn.microsoft.com/en-us/windows/win32/printdocs/StartDocPrinter * * 函数通知打印后台处理程序文档将进行假脱机打印 * @link https://learn.microsoft.com/zh-cn/windows/win32/printdocs/StartDocPrinter */ declare function StartDocPrinter(options: StartDocPrinterOptions): Promise<boolean>; export { ClosePrinter, EndDocPrinter, EnumPrinters, type EnumPrintersOptions, FindWindowEx, GetDefaultPrinter, GetPrinter, type GetPrinterOptions, GetWindowText, MessageBox, type MessageBoxOptions, OpenPrinter, StartDocPrinter, type StartDocPrinterOptions };