Einzelnen Beitrag anzeigen

haidomingo

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

Re: How to set use printer offline

  Alt 8. Nov 2009, 11:45
Zitat von toms:
Hi, read this ms article (HOWTO: How To Change the Work Offline Status of a Printer)
Help, I can not find the solution!

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