How to Dynamically Change Values in Populated _PDPARMS

Last reviewed: April 18, 1995
Article ID: Q118553
The information in this article applies to:
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, 2.5a, 2.5b, 2.6

SUMMARY

To change values or escape codes in the _PDPARMS array programmatically and have them take effect the next time a print job is sent to the printer, you must use the Xbase version of the non-PostScript printer drivers instead of the C-based driver, which is DRIVER2.PLB.

MORE INFORMATION

When DRIVER2.PLB is used, the _PDPARMS array is populated when the default printer driver is set. After that, _PDPARMS is not read from memory, and DRIVER2.PLB, along with the settings saved in the FOXUSER.DBF, controls how the escape codes are sent to the printer. Therefore, any changes that are made programmatically to _PDPARMS are ignored.

To change the printer driver from DRIVER2.PLB to the non-PostScript Xbase driver, DRIVER.PRG, do the following:

  1. Open the GENPD.PJX project, which is normally found in the <FoxPro_directory>\GOODIES\PDRIVERS subdirectory.

  2. Open the GEN_PD.PRG file and search for the following line:

          _PDRIVER = "DRIVER.PRG"
    

  3. Follow the instructions in GEN_PD.PRG that describe how to use the Xbase version of the non-PostScript printer driver.

  4. Rebuild the GENPD.APP file and copy it into the main FoxPro directory.

The code below demonstrates how to programmatically change to condensed and bold print by changing the escape codes in _PDPARMS. The array elements that control condensed and bold printing are _PDPARMS(9) and _PDPARMS(11), respectively. This code assumes that there is a printer driver named HP3 saved in the Printer Driver Setup dialog box. Note that the escape codes below are case sensitive.

   ** Begin Code Example **

   SET PDSETUP TO "hp3"
   SET PRINTER TO LPT1
   SET PRINTER ON
   **
    _PDPARMS(9)=CHR(27)+"(s16.6H"      && Set up for condensed print.
   _PDPARMS(11)=CHR(27)+"(s3B"         && Turn on bold.
   **
   ?"This is a test of printing in BOLD and CONDENSED."
   **
   _PDPARMS(9)=CHR(27)+"(s10H"         && Return to normal printing.
   _PDPARMS(11)=CHR(27)+"(s0B"         && Not bold.
   **
   ?"Now return to normal printing"
   **
   SET PRINT OFF
   SET PRINT TO

   ** End Code Example **

For a listing of the array elements in _PDPARMS, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q95309
   TITLE     : How _PDPARMS Array Is Created for a Printer Driver
               Setup


Additional reference words: FoxDos 2.00 2.50 2.50a 2.50b 2.60 pdparms
KBCategory: kbprg kbcode
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 18, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.