Einzelnen Beitrag anzeigen

haidomingo

Registriert seit: 23. Jul 2009
23 Beiträge
 
#5

Re: How to set use printer offline

  Alt 7. Nov 2009, 17:34
Zitat von toms:
Hi, read this ms article (HOWTO: How To Change the Work Offline Status of a Printer)
Thanks.

Where I wrong?

Delphi-Quellcode:
var
   SelectedPrinter: string;
   hSelPrn : dword;
   PrinterInfo : TPrinterInfo2A;
   bytesNeeded : dword;
   dwStatusMask : DWORD;
begin
    SelectedPrinter:=Printer.Printers[Printer.PrinterIndex];
    if OpenPrinter(PChar(SelectedPrinter), hSelPrn, nil) then begin
       GetPrinter(hSelPrn, 2, @PrinterInfo, SizeOf(PrinterInfo), @bytesNeeded);
       dwStatusMask:=dWord(PRINTER_ATTRIBUTE_WORK_OFFLINE);
       PrinterInfo.Attributes:=PrinterInfo.Attributes and dwStatusMask;
       SetPrinter(hSelPrn, 2, @PrinterInfo, 0);
       ClosePrinter(hSelPrn);
    end;
end;
  Mit Zitat antworten Zitat