function TPrinterStateThread.Get_Printer_State(hPrinter: THandle): String;
var
Size: DWORD;
pInfo2: ^TPrinterInfo2;
begin
WinSpool.GetPrinter(hPrinter, 2, pInfo2, 0, @Size);
GetMem(pInfo2, Size);
try
if WinSpool.GetPrinter(hPrinter, 2, pInfo2, Size, @Size) then
Result := Get_Printer_Statues(pInfo2.Status)
else
Result := SysErrorMessage(GetLastError);
finally
FreeMem(pInfo2);
end;
end;
我程序中的其中一个函数,你参考一下吧~
PRINTER_STATUS_PAPER_OUT是没纸~