Solved

Getting a printers status if there is no windows print driver

Posted on 1997-06-21
8
245 Views
Last Modified: 2010-04-04
I want to be able to get the status from a printer connected to LPT1,LPT2 etc. The printer has no windows print driver installed, its data is sent via a text file opened as LPT1 etc. Any solutions?
0
Comment
Question by:DaveG
  • 5
  • 2
8 Comments
 

Expert Comment

by:bsys
Comment Utility
I guess that this is the same question as I asked before (a couple of days ago).
So the value for this question is 200 + 230 points (isn't that worth the answer??).
(FOR WHAT KIND OF APPLICATION THAT)
0
 

Expert Comment

by:bsys
Comment Utility
Can this software be used for COM ports also???
0
 
LVL 3

Expert Comment

by:sperling
Comment Utility
What delphi and windows version(s) do you need to support?

Regards,

Erik.
0
 

Accepted Solution

by:
bsys earned 200 total points
Comment Utility
I have found it!!! I have two assembler routines, one for a com port and one for a lpt port!! It works just fine, let me know if you are interested!!! I'll send it by E-Mail!!!
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Expert Comment

by:bsys
Comment Utility
Here it is DaveG,I am using this in my POS program:

function TPrinterStatusForm.CheckCOM(Printer: Word): Word;
var
   PS: Word; {PS = Printer Status}
begin
     asm
       mov dx,Printer {COM, starts from 0}
       mov ax,300h
       int 14h
       and ax, 127
       mov PS,ax
     end;
     Result := PS;
end;

function TPrinterStatusForm.CheckLPT(Printer: Word): Word;
var
   PS: Byte; {PS = Printer Status}
begin
     asm
       mov dx,Printer {LPT}
       mov ah,02h {Status request}
       int 17h
       mov PS,ah
     end;
     Result := PS;
end;

And this works!!!
0
 

Expert Comment

by:davegreen
Comment Utility
This is the routine I worked out myself from investigation- it is more or less the same:

function PrinterStatus(OutFile: Word) : byte;
var
  PrinterPort: Word;

  function GetStatus : byte;
  asm
     mov AH,$02 {get printer status}
     mov DX, PrinterPort   {lpt1=0, lpt2=1}
     Int $17   {get printer status}
     mov AL, AH
  end;
begin
  PrinterPort := OutFile;
  Result := GetStatus;
end;


The bits returned should correspond as follows

7 6 5 4 3 2 1 0   bit value
-----------------------------
1                   printer not busy
0                   printer busy
  1                 printer acknowledgment
    1               out of paper
      1             printer selected
        1           i/o error
          ? ?       unused
              1     timeout

This code works too....
0
 

Expert Comment

by:davegreen
Comment Utility
I withdraw this question...
0
 

Expert Comment

by:bsys
Comment Utility
Ok, what do you want then?????????
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now