Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Checking COM Port
Hi,

Is there a way to check through COM port if printer is ready or out of
paper.
For LPT port we could use IsPrinter(). Heard that there is a function
Isport() that may do this for COM port checking of printer status.

The tricky part here is sometimes com ports may be connected to POS
display, modem or etc.

TIA

Regards
Benny

Report this thread to moderator Post Follow-up to this message
Old Post
Benny Yap Kok Meng
05-26-05 08:55 AM


Re: Checking COM Port
What type of printer?

Benny Yap Kok Meng wrote:
> Hi,
>
> Is there a way to check through COM port if printer is ready or out of
> paper.
> For LPT port we could use IsPrinter(). Heard that there is a function
> Isport() that may do this for COM port checking of printer status.
>
> The tricky part here is sometimes com ports may be connected to POS
> display, modem or etc.
>
> TIA
>
> Regards
> Benny


Report this thread to moderator Post Follow-up to this message
Old Post
J. Webb
05-26-05 08:55 PM


Re: Checking COM Port
Basically a 40 column receipt printer.
Normally we use the DOS MODE command to redirect the LPT port to either COM1
 or COM2

Regards
Benny

"J. Webb" <webbsoft2@hotmail.com> wrote in message news:<1117128877.630585.23250@g43g2000cw
a.googlegroups.com>...
> What type of printer?
>
> Benny Yap Kok Meng wrote: 

Report this thread to moderator Post Follow-up to this message
Old Post
Benny Yap Kok Meng
05-27-05 08:55 PM


Re: Checking COM Port
"Benny Yap Kok Meng" <bennyyap@hotmail.com> wrote in message
news:785a8fe9.0505252101.7dc16e2b@posting.google.com...
> Is there a way to check through COM port if printer is ready or out of
> paper.
> For LPT port we could use IsPrinter(). Heard that there is a function
> Isport() that may do this for COM port checking of printer status.
>
Try FT_ISPRINT() from the Nanforum Toolkit
(http://www.the-oasis.net/files/library/nflib305.zip).

> The tricky part here is sometimes com ports may be connected to POS
> display, modem or etc.
>
Tell your users to stop messing around with the cables! :-)

> TIA
>
> Regards
> Benny
You're welcome
--
Norman Perelson
http://www.shopkeeper.co.za



Report this thread to moderator Post Follow-up to this message
Old Post
Norman Perelson
05-27-05 08:55 PM


Re: Checking COM Port
hi,

check  FT_ISPRINT() from NanFor.LIB.

greetings by OHR
Jimmy


Check printer status

Syntax

FT_ISPRINT( [ <cDevice> ] ) -> lResult

Arguments

<cDevice> is optional and is the device to test (LPT2, COM1, etc.).
If omitted, the function will default to the PRN device.

Returns

.T.  if device is ready for output.
.F.  if one of the following conditions occurs:
1)  The device is not ready.
2)  The device does not exist.
3)  DOS couldn't open the device for some reason
(such as no file handles available).

Description

The Clipper IsPrinter() function is somewhat limited because it only
works with LPT1.  Furthermore, it talks directly to the hardware, so
if you have redirected LPT1 via the DOS MODE command, the IsPrinter()
function will return erroneous results.

This function offers a better alternative.  Instead of talking to the
hardware, it issues a DOS call that checks to see if the device is
ready or not.  That gives DOS an opportunity to deal with any
redirections, and since you pass the device name as a parameter, you
can test any device, not just LPT1 (note that the function defaults
to PRN if you fail to pass a valid parameter).

The function also temporarily traps the DOS critical error handler so
you don't get any nasty error messages if the device isn't ready.  It
restores the old critical error handler before exiting.

Note that although this function is mainly designed for testing
printers, you can also check to see if a drive is ready.  Since DOS
thinks the NUL device exists on every drive, you can pass a drive
letter followed by NUL as a parameter.  If DOS is able to open the
NUL device, then the drive is ready, otherwise the door is open or
something else is wrong.

The source code is written to adhere to Turbo Assembler's IDEAL mode.
To use another assembler, you will need to rearrange the PROC and
SEGMENT directives, and also the ENDP and ENDS directives (a very
minor task).

Examples

IF ! FT_ISPRINT()
Qout( "PRN is not ready!" )
ENDIF

IF ! FT_ISPRINT( "COM2" )
Qout( "Check the device on COM2.  Something is wrong." )
ENDIF

IF ! FT_ISPRINT( "A:\NUL" )
Qout( "Oops, better check drive A!" )
ENDIF

Source: ISPRINT.ASM

Author: Ted Means


> Is there a way to check through COM port if printer is ready or out of
> paper.
> For LPT port we could use IsPrinter(). Heard that there is a function
> Isport() that may do this for COM port checking of printer status.
>
> The tricky part here is sometimes com ports may be connected to POS
> display, modem or etc.



Report this thread to moderator Post Follow-up to this message
Old Post
AUGE_OHR
05-27-05 08:55 PM


Re: Checking COM Port
Thanks Norman & Jimmy,

Norman - > I bet ya users are users. Thay normally tend to remove the
cables or make the printer offline.

Jimmy - I shall have a try on it. Anyway do I still need to set the
DOS MODE like below under autoexec.bat if FT_ISPRINT() is used :-

MODE COM1:9600,e,7,1
MODE COM2:9600,e,7,1
MODE LPT1=COM1
MODE LPT1=COM2

Thanks

Regards
Benny

"AUGE_OHR" <***AUGE_OHR@CSI.COM> wrote in message news:<d77jn3$73l$03$1@news.t-online.com>.
.
> hi,
>
> check  FT_ISPRINT() from NanFor.LIB.
>
> greetings by OHR
> Jimmy
>
>
>  Check printer status
>
>  Syntax
>
>      FT_ISPRINT( [ <cDevice> ] ) -> lResult
>
>  Arguments
>
>     <cDevice> is optional and is the device to test (LPT2, COM1, etc.).
>     If omitted, the function will default to the PRN device.
>
>  Returns
>
>     .T.  if device is ready for output.
>     .F.  if one of the following conditions occurs:
>          1)  The device is not ready.
>          2)  The device does not exist.
>          3)  DOS couldn't open the device for some reason
>              (such as no file handles available).
>
>  Description
>
>     The Clipper IsPrinter() function is somewhat limited because it only
>     works with LPT1.  Furthermore, it talks directly to the hardware, so
>     if you have redirected LPT1 via the DOS MODE command, the IsPrinter()
>     function will return erroneous results.
>
>     This function offers a better alternative.  Instead of talking to the
>     hardware, it issues a DOS call that checks to see if the device is
>     ready or not.  That gives DOS an opportunity to deal with any
>     redirections, and since you pass the device name as a parameter, you
>     can test any device, not just LPT1 (note that the function defaults
>     to PRN if you fail to pass a valid parameter).
>
>     The function also temporarily traps the DOS critical error handler so
>     you don't get any nasty error messages if the device isn't ready.  It
>     restores the old critical error handler before exiting.
>
>     Note that although this function is mainly designed for testing
>     printers, you can also check to see if a drive is ready.  Since DOS
>     thinks the NUL device exists on every drive, you can pass a drive
>     letter followed by NUL as a parameter.  If DOS is able to open the
>     NUL device, then the drive is ready, otherwise the door is open or
>     something else is wrong.
>
>     The source code is written to adhere to Turbo Assembler's IDEAL mode.
>     To use another assembler, you will need to rearrange the PROC and
>     SEGMENT directives, and also the ENDP and ENDS directives (a very
>     minor task).
>
>  Examples
>
>     IF ! FT_ISPRINT()
>        Qout( "PRN is not ready!" )
>     ENDIF
>
>     IF ! FT_ISPRINT( "COM2" )
>        Qout( "Check the device on COM2.  Something is wrong." )
>     ENDIF
>
>     IF ! FT_ISPRINT( "A:\NUL" )
>        Qout( "Oops, better check drive A!" )
>     ENDIF
>
>  Source: ISPRINT.ASM
>
>  Author: Ted Means
>
> 

Report this thread to moderator Post Follow-up to this message
Old Post
Benny Yap Kok Meng
05-29-05 08:55 AM


Re: Checking COM Port
Basically a 40 column receipt printer.
Normally we use the DOS MODE command to redirect the LPT port to either COM1
 or COM2

Regards
Benny

"J. Webb" <webbsoft2@hotmail.com> wrote in message news:<1117128877.630585.23250@g43g2000cw
a.googlegroups.com>...
> What type of printer?
>
> Benny Yap Kok Meng wrote: 

Report this thread to moderator Post Follow-up to this message
Old Post
Benny Yap Kok Meng
05-30-05 08:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Clipper archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 10:23 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.