PRB: SET PRINTER ON and ??? Cause an Unnecessary Page Eject

Last reviewed: April 30, 1996
Article ID: Q114186
The information in this article applies to:
  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, and 2.5b

SUMMARY

In FoxPro for Windows, when you combine the SET PRINTER ON command with the ??? command to output data to a printer, a blank page ejects prior to the print job being sent.

CAUSE

When the SET PRINT ON command is issued, a print job is started. When the ??? command is issued, the current print job is closed, and a new raw print job is opened.

In FoxPro for Windows, when a print job is opened and then closed, a blank page will be printed even if no output was sent.

WORKAROUND

In FoxPro for MS-DOS, create a printer driver using the Generic printer settings. You can then use this printer driver in FoxPro for Windows.

To do this:

  1. Load FoxPro for MS-DOS. Set your resource (FOXUSER) file to the one that you will use for your FoxPro for Windows applications. If this is the resource file in your FoxPro for Windows directory and that directory is called FOXPROW and is located on drive C, type the following command:

          SET RESOURCE TO c:\foxprow\foxuser
    

    Doing this ensures that the printer driver is stored in the correct resource file.

  2. From the File menu, choose Printer Setup.

  3. Select the Printer Driver Setup check box, and then choose New.

  4. In the Printers list box, scroll down to the Generic Printer driver.

  5. In the Setup Name box, type "Generic" (without the quotation marks), and then choose OK.

  6. In the Printer Driver Setups dialog box, choose either Cancel or Set. It does not matter for the purpose of creating the printer driver.

  7. In the Printer Setup dialog box, choose OK.

  8. Exit FoxPro for MS-DOS. Load FoxPro for Windows. In the Command window, type:

         SET PDSETUP TO "Generic"
         SET PRINTER ON
    
         ??? ''                              && Opens printer in 'raw' mode
         ? "I set the printer in raw mode"
         ??? CHR(27)+"(s3B"
         ? "I am printing bold"
         ??? CHR (27) + "(s0B"
         ? "Now it's not bold"
         SET PRINTER OFF
         SET PRINTER TO
    
    
For additional information, please see the following article(s) in the Microsoft Knowledge Base:

   ARTICLE-ID: Q99542
   TITLE     : Printing Reports Created w/ Question Marks in
               FP for Win

MORE INFORMATION

Steps to Reproduce Problem

The following code causes a blank page to eject prior to the print job that is sent. It seems that the page eject occurs at the location of the first ??? command (that is, if you remove the first ??? command, the page eject occurs after the first line of text is printed).

   ** The escape codes in this program are for an HP laser printer.
   ** They are for illustration purposes only.

   SET PRINTER ON
   ??? ''                             && Opens printer in 'raw' mode
   ? "I set the printer in raw mode"
   ??? CHR(27)+"(s3B"
   ? "I am printing bold"
   ??? CHR (27) + "(s0B"
   ? "Now it's not bold"
   SET PRINTER OFF
   SET PRINTER TO


Additional reference words: FoxWin 2.50 2.50a 2.50b
KBCategory: kbprg kbprb
KBSubcategory: FxprintRaw


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 30, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.