Setting a Default Printer Driver in a Stand-Alone .EXE

ID: Q99909


The information in this article applies to:


SUMMARY

By default, a stand-alone .EXE file cannot use the default printer driver setup. This is because the support libraries built into the executable file do not contain all the printer driver information. To create a stand-alone .EXE file that can use a default printer driver, either create a compact executable file or use the program below.


MORE INFORMATION

To create a stand-alone .EXE file that can use the default printer driver setup, place the following code at the top of the main program file in the .EXE file. Make sure GENPD.APP is included in the project and marked as Excluded.

This program searches the FoxUser file for a default printer driver, and if there is no default driver available, a dialog box to select a printer driver appears.


   mresource = SYS(2005)    && Store current Resource file.
   SET RESOURCE OFF
   USE &mresource           && USE the Resource file.
   LOCATE FOR '-' $ name    && Search FoxUser for default printer.
   IF FOUND ()
      drvr = substr(name,2,LEN(name)-1)   && Store default printer
                                          &&   driver to drvr.
      USE                   && Close Resource file.
      SET RESOURCE TO &mresource  && Set Resource on.
      SET PDSETUP TO drvr         && Set default printer driver.
   ELSE
      USE                         && Close Resource file.
      SET RESOURCE TO &mresource  && Set Resource on.
      SET PDSETUP TO "?"    && Allows selection of a printer driver.
   ENDIF 

Additional query words: FoxDos standalone


Keywords          : 
Version           : 
Platform          : 
Issue type        : 

Last Reviewed: August 3, 1999