Ver Mensaje Individual
  #2  
Antiguo 07-01-2011
genius genius is offline
Miembro
 
Registrado: may 2006
Posts: 38
Reputación: 0
genius Va por buen camino
Prueba con esto

Prueba a ver si te funciona con esto , deberias de arrojarlo en un archivo log para ver que sucede y tratar el error con try except end, suerte

Código Delphi [-]
Procedure TForm1.ShowPrinterStatus( const PrinterName : String );
Var
  PrinterInfo: PPrinterInfo2;
  PrinterHandle : THandle;
  Stat : LongBool;
  requiredSize : Cardinal;

Begin
  Try
    Stat := OpenPrinter( PChar(PrinterName), PrinterHandle, NIL ); //
This works fine

    If ( Stat )
      Then
        Begin
          Try
            GetMem( PrinterInfo, 1024 );
            Stat := GetPrinter(PrinterHandle, 2, PrinterInfo, 1024,
@requiredSize );
            Edit2.Text := 'Printer Name Is: ' +
PrinterInfo^.pPrinterName;

            Case PrinterInfo^.Status of
              0 : Edit1.Text := 'Printer Ready!';
              PRINTER_STATUS_DOOR_OPEN : Edit1.Text := 'Door Open';
              PRINTER_STATUS_POWER_SAVE : Edit1.Text := 'Power Save
Mode';
              PRINTER_STATUS_WARMING_UP : Edit1.Text := 'Warming Up';
              PRINTER_STATUS_PAPER_OUT :  Edit1.Text := 'Out of Paper';
            End;
          Finally
            FreeMem( PrinterInfo, 1024 );
          End;
        End
      Else
        Begin
          Edit1.Text := 'NA';
          Edit2.Text := 'Cannot Open Printer: ' + PrinterName;
        End;
   Finally
     ClosePrinter( PrinterHandle );
   End;
End;
Responder Con Cita