Board index » delphi » Getting Feedback from printers

Getting Feedback from printers

Using TP7 under Win98SE

I use IOResult to get error conditions when accessing files (eg file does
not exist, etc).
Is there any way to use IOResult to get error conditions from printers, eg
Out of Paper, Printer switched Off, and so on?  The function does not seem
to return an error code under any conditions.

I have both HP Deskjet 600 and Canon BJC-210SP printers

Thanks

Alan

 

Re:Getting Feedback from printers


Quote
Alan Brown wrote:
> I use IOResult to get error conditions when accessing files (eg file does
> not exist, etc).
> Is there any way to use IOResult to get error conditions from printers, eg
> Out of Paper, Printer switched Off, and so on?  The function does not seem
> to return an error code under any conditions.

You'll have to write your own printer device driver to grab printer
failures via IOResult. A couple of years ago I wrote a unit to handle
printers on parallel/serial ports with options to set handshake,
timeout, portnumbers etc using an AssignCom/AssignLpt command (like the
AssignCrt in the CRT unit). If there was a problem with the printer, a
popup window appeared with the usual Abort/Retry/Ignore options - two of
them returning an error to IOResult.
Please let me know if this is of any interest (please note I will not be
able to send them until monday).

/klaus

Re:Getting Feedback from printers


I am very interested!
I have a Canon BJC 3000 & HP Deskjet 500c.
Please send it to me!
Thanks already,

Peter van Rijt
The Netherlands

"Klaus" <p102882...@mail.uni2.dk> schreef in bericht
news:3BC55526.B77ED53@mail.uni2.dk...

Quote
> Alan Brown wrote:
> > I use IOResult to get error conditions when accessing files (eg file
does
> > not exist, etc).
> > Is there any way to use IOResult to get error conditions from printers,
eg
> > Out of Paper, Printer switched Off, and so on?  The function does not
seem
> > to return an error code under any conditions.

> You'll have to write your own printer device driver to grab printer
> failures via IOResult. A couple of years ago I wrote a unit to handle
> printers on parallel/serial ports with options to set handshake,
> timeout, portnumbers etc using an AssignCom/AssignLpt command (like the
> AssignCrt in the CRT unit). If there was a problem with the printer, a
> popup window appeared with the usual Abort/Retry/Ignore options - two of
> them returning an error to IOResult.
> Please let me know if this is of any interest (please note I will not be
> able to send them until monday).

> /klaus

Re:Getting Feedback from printers


Under TP, you have 2 port arrays available, Port and PortW.  I use Port to
check on Printer Status.

The LPT1 port is normally at $378 (decimal address is 888).  You want to look
at the upper four bits of the second byte at that port. Retrieve the value at
$379 and use div 16.

If Status = 13, Printer is OnLine.  I can't find my notes just now but a
little testing should get you the rest of the codes you need.

One word of caution - I am running TP7 programs under Win98SE.  If you test
for printer OnLine before opening the file to the Printer you will avoid most
problems under Win98. As I recall, you can even check the printer before each
line is sent. However, if an error occurs while the line is being printed,
there is no way to avoid a crash.

I hope this helps.

Quote
Alan Brown wrote:
> Using TP7 under Win98SE

> I use IOResult to get error conditions when accessing files (eg file does
> not exist, etc).
> Is there any way to use IOResult to get error conditions from printers, eg
> Out of Paper, Printer switched Off, and so on?  The function does not seem
> to return an error code under any conditions.

> I have both HP Deskjet 600 and Canon BJC-210SP printers

> Thanks

> Alan

--
Val Mehling
va...@earthlink.net

Web Pages
http://home.earthlink.net/~valjm/

XRL (Extreme Racing League) Pics
http://odin.prohosting.com/~valjm

http://odin.prohosting.com/valmeh/

Re:Getting Feedback from printers


Quote
> Alan Brown wrote:
> > I use IOResult to get error conditions when accessing files (eg file
does
> > not exist, etc).
> > Is there any way to use IOResult to get error conditions from printers,
eg
> > Out of Paper, Printer switched Off, and so on?  The function does not
seem
> > to return an error code under any conditions.

> You'll have to write your own printer device driver to grab printer
> failures via IOResult. A couple of years ago I wrote a unit to handle
> printers on parallel/serial ports with options to set handshake,
> timeout, portnumbers etc using an AssignCom/AssignLpt command (like the
> AssignCrt in the CRT unit). If there was a problem with the printer, a
> popup window appeared with the usual Abort/Retry/Ignore options - two of
> them returning an error to IOResult.
> Please let me know if this is of any interest (please note I will not be
> able to send them until monday).

> /klaus

Klaus

Thanks for your reply
I would be interested in your unit - my email address is alanlb AT optusnet
DOT com DOT au

Any time - there is no hurry

Thanks again

Alan

Re:Getting Feedback from printers


Hi Val,

Quote
> Under TP, you have 2 port arrays available, Port and PortW.  I use Port
to
> check on Printer Status.

> The LPT1 port is normally at $378 (decimal address is 888).  You want to
look
> at the upper four bits of the second byte at that port. Retrieve the
value at
> $379 and use div 16.

> If Status = 13, Printer is OnLine.  I can't find my notes just now but a
> little testing should get you the rest of the codes you need.

I have an old book giving DOS and BIOS information -  interrupt 17H
returns the printer status flags  -  I should have looked here before!!!

Quote

> One word of caution - I am running TP7 programs under Win98SE.  If you
test
> for printer OnLine before opening the file to the Printer you will avoid
most
> problems under Win98. As I recall, you can even check the printer before
each
> line is sent. However, if an error occurs while the line is being
printed,
> there is no way to avoid a crash.

> I hope this helps.

> Val Mehling

Thank you much for your suggestion, I will try it out.

Alan

Other Threads