UNPKG

win32-api

Version:

FFI definitions of windows win32 api for node-ffi

23 lines 900 B
import { load } from '../../lib/winspool/index.js'; const funcName = 'OpenPrinterW'; // type RetType = ReturnType<FnType> // type ParamType = Parameters<FnType> /** * 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 */ export async function OpenPrinter(printerName) { const lib = load([funcName]); const buf = Buffer.alloc(8); const res = await lib.OpenPrinterW_Async(printerName, buf, null); if (!res) { return null; } // const hwnd = ffi.address(buf) const hwnd = buf.readBigUInt64LE(); return hwnd; } //# sourceMappingURL=OpenPrinter.js.map