Using MS-DOS PRINT Spooler from Within FoxPro

Last reviewed: April 17, 1995
Article ID: Q99547
The information in this article applies to:
  • Microsoft FoxPro for MS-DOS, versions 1.02, 2.0, 2.5, and 2.5a

SYMPTOMS

When you are printing very lengthy reports on non-Windows systems, the delay before printing begins can be quite long. However, when the same report is sent directly to the PRINT facility of MS-DOS, it will begin spooling immediately to the printer in the background.

CAUSE

The PRINT program has a resident portion that must be loaded into memory, which takes some time.

RESOLUTION

To avoid this delay, you can load the PRINT program before invoking FoxPro (consult your MS-DOS manual for other start-up options available for PRINT). This can be done by creating a batch file that first loads PRINT, and then loads FoxPro. The PRINT command expects confirmation of the default printer device the first time it is invoked. Since FoxPro should always use the default device PRN as its printer device, a file containing a single carriage return can be created and used with the MS-DOS input redirection character to automate the process. The output messages can also be redirected to the NUL device.

The following example assumes that you are using the MS-DOS 5.0 editor; if you aren't, make substitutions as needed.

  1. At the MS-DOS command prompt, type "EDIT OK.PRN" (without the quotation marks) and press ENTER. Press the ENTER key again, and then press ALT+F, X, and then ENTER to save the file.

  2. At the MS-DOS command prompt, type "EDIT FOXP.BAT" (without the quotation marks). Type in the following information:

          PRINT <OK.PRN >NUL
          CD\FOXPRO25
          FOXPRO
          CD\
    

    Press ALT+F, X, and then ENTER to save the file.

To begin a session of FoxPro with PRINT available, type "FOXP" (without the quotation marks) at the MS-DOS prompt and press ENTER. From within the FoxPro application program, the filename to be printed can be passed in a variable. For example, you can write a report to a file named BIGRPT.TXT, which you can then print as follows:

   REPORT FORM megalist TO bigrpt   && .TXT default file extension.
   fyl="BIGRPT.TXT"
   *-----or could have been:
   *-----   fyl=GETFILE("TXT","Select report to print")
   RUN PRINT &fyl

NOTE: The resident portion of PRINT will reduce the amount of available conventional memory to FoxPro by approximately 40K. Therefore, running FoxPro with PRINT may not be optimal in every situation.


Additional reference words: FoxDos 2.00 2.50 2.50a spooler
KBCategory: kbprint kbtool kbprg
KBSubcategory:


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 17, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.