This is how printing is handled by the library
functions. You need not follow this method except where it is
imbedded in SuperLib metafunctions.
The function SLS_PRN() is a SET/RETRIEVE function
which sets and retrieves the default printer port as a string
with the default as "LPT1". This function may be called with any
valid printer port name as a parameter to set a new printer port
for SuperLib usage.
Valid values are "LPT1", "LPT2", "LPT3", "COM1",
"COM2" - anything you could issue a SET PRINTER TO
Another SET/RETRIEVE function - SLS_PRNC() - points
to the setting which determines if the printer port will be
checked for readiness before printing. Passing it a False causes
it to not check the printer before printing - handy in some
At print time, LPT* ports are checked for readiness
via the P_READY() function. (COM ports are not checked for
readiness.) However, if SLS_PRNC() has been passed a .f., no
check for readiness is done.
P_READY() uses the .ASM function ISPRN() to check for
If the port is not ready, the user is given
the option to: Try Again
Ignore the Warning
Select a Different Printer Port
Abort the print request
If Abort is selected, P_READY() returns false.
SLS_PRN() A Superlib printer setting function
<cSetting> => Current value of the setting
Function Setting Default
SLS_PRN([cNew]) Default printer 'LPT1'
[cNew] sets the setting to a new setting
If [cNew] is passed, the setting is changed and the
new setting is returned.
SET PRINTER TO (SLS_PRN())
PRNPORT() Determine Printer Port to use
<cPort> => port chosen
Allows user to select printer port for SET PRINTER TO
output. Printer is set to this port
[cPort1-9] are valid SET PRINTER TO strings
LPT1 LPT2 LPT3 COM1 COM2 COM3 COM4 <FILENAME>
Default is "LPT1","LPT2","LPT3"
cTheport := PRNPORT("LPT1","COM1")
Cancel a specific NetWare print queue capture
FT_ENDCAP( [ <nLPTPortNumber> ] ) -> lResult
Arguments<nLPTPortNumber> is the captured LPT port to cancel. If the
parameter is omitted, the default port of LPT1: is used.
.T. if successful
This routine is used to close a specific capture on the specified LPT
port. When this command is issued, the LPT port is no longer redirected
to the print queue, and any information waiting in queue to be printed
will be printed.
This routine was designed and written for Advanced NetWare 286 v 2.1 or
NetWare 386 v 3.0 or better. It has been tested on Advanced NetWare 286
v 2.15 rev A & C and NetWare 386 v 3.0.
This source code was written for Microsoft Macro Assembler v 5.1. It
should work with any assembler with minor modifications.
F:>CAPTURE S=ServerName Q=PrintQueueName T=0 L=2
Device LPT2: re-routed to queue PrintQueueName on server ServerName.
F:>CAPTURE S=ServerName Q=PrintQueueName T=0 L=1
Device LPT1: re-routed to queue PrintQueueName on server ServerName.
(in your Clipper application)
FT_ENDCAP(2) // Closes LPT2: capture, and flushes print buffer
FT_ENDCAP() // Closes LPT1: (default) capture, and flushes
// print buffer
Author: James R. Zack
Check printer status
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.
.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).
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
IF ! FT_ISPRINT()
Qout( "PRN is not ready!" )
IF ! FT_ISPRINT( "COM2" )
Qout( "Check the device on COM2. Something is wrong." )
IF ! FT_ISPRINT( "A:\NUL" )
Qout( "Oops, better check drive A!" )
Author: Ted Means