Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 165
  • Last Modified:

Getting printer information

Hi,
I need to know if the printer is on-line before sending a report to it. Any idea?
Thanks

Fabio
0
binho
Asked:
binho
  • 2
1 Solution
 
PeterLarsenCommented:
You can use "GetPrinter" to receive info about any printer attached to your computer.
I dont know whether this also works with network printers or not.
0
 
marcoszorrillaCommented:
From Torrys.

...detect Printer status?
Author: Colombo Gianluca  

function TestPrinterStatus(LPTPort: Word): Byte;
var
  Status: byte;
  CheckLPT: word;
begin
  Status := 0;
  if (LPTPort >= 1) and (LPTPort <= 3) then
  begin
    CheckLPT := LPTPort - 1;
    asm
      mov dx, CheckLPT;
      mov al, 0;
      mov ah, 2;
      int 17h;
      mov &Status, ah;
    end;
  end;
  Result := Status;
end;


{
  Pass in the LPT port number you want to check & get the following back:
  01h - Timeout
  08h - I/O Error
  10h - Printer selected
  20h - Out of paper
  40h - Printer acknowledgement
  80h - Printer not busy (0 if busy)

  Note:
  This function doesn't work under NT, it gives an access violation
  from the DOS interrupt call.
}

Best Regards.
Marcos.

0
 
marcoszorrillaCommented:
Mor Examples.

AssignFile(IMpresora,'lpt1');   // Impresora : TExtFile;
{$I-}
Rewrite(Impresora);
{$I+}
if ioresult<>0 then ERROR


With Assembler

function IsPrinter : Boolean;
Const
    PrnStInt  : Byte = $17;
    StRq      : Byte = $02;
    PrnNum    : Word = 0;  { 0 para LPT1, 1 para LPT2, etc. }
Var
  nResult : byte;
Begin  (* IsPrinter*)
Asm
   mov ah,StRq;
   mov dx,PrnNum;
   Int $17;
   mov nResult,ah;
end;
IsPrinter := (nResult and $80) = $80;
End;

Best Regards
Marcos.
0
 
CleanupPingCommented:
binho:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now