FoxPro 2.6 for Windows: Most Frequently Asked Questions

Last reviewed: April 30, 1996
Article ID: Q112568
The information in this article applies to:
  • Microsoft FoxPro for Windows, version 2.6

This article contains answers to frequently asked questions about Microsoft FoxPro version 2.6 for Windows. This article is divided into four sections:

   Installation
   Cross-Platform
   Screen Builder
   Printer Drivers

PART 1: INSTALLATION

  1. Q. What are the minimum files required to run FoxPro?

        A. Not all files placed on the hard disk during installation of FoxPro
           are absolutely required for operation of the product.
    

           The minimum files needed to run FoxPro version 2.6, use the menu and
           screen generators, and set printer drivers are listed below.
    

           NOTE: Upon startup, FoxPro will create FOXUSER.DBF and FOXUSER.FPT
           files, and upon screen or menu generation, it will create the
           appropriate .FXP files.
    

              Filename         Bytes      Comments
              -------------------------------------------------------------
    
              FOXPROW.EXE    2498282
              TRANSPRT.PRG    390203      Only needed if you are converting
                                          files from FoxPro version 2.0 for
                                          MS-DOS or want to create cross-
                                          platform applications.
              GENSCRN.PRG     292613
              GENPD.APP       374351
              FOXTOOLS.FLL     58530
              GENMENU.PRG      57019
              PSAPI.FLL        27668
              DRIVER2.FLL      17876
              GENXTAB.PRG      29246
              RESERVED.FLL     12764
    
    

PART 2: CROSS-PLATFORM

  1. Q. Why doesn't my low-level file I/O program work in FoxPro for

           Windows?
    

        A. FoxPro for Windows cannot access the COM ports with the low-level
           file commands.
    

           This fact is mentioned in the documentation for the FOPEN() command,
           but many people who are accustomed to opening a port in FoxPro for
           MS-DOS may test this function and think it doesn't work correctly.
    

           This behavior is not a bug--it is part of the product's design. In
           the Windows multitasking environment, other applications besides
           FoxPro may also be using the COM ports. Therefore, it is not
           desirable to allow a Windows-based application to take exclusive
           control of the communications port.
    

           Access to the COM port is provided through FOXTOOLS.FLL and the
           Windows API calls. For an example of how to use the COM port under
           the Windows environment, see the DIALER.PRG file in the
           FOXPROW\GOODIES\FOXTOOLS subdirectory.
    

           The use of the REGFN() and CALLFN() functions is documented in the
           FOXTOOLS.WRI file in the same directory as the DIALER.PRG example.
    

           For information about specific API calls, refer to the Windows
           Software Development Kit (SDK) documentation.
    

PART 3: SCREEN BUILDER

  1. Q. How do I coordinate Browse windows with screens?

        A. Page D2-96 of the FoxPro for Windows "Developer's Guide" and page
           D2-90 of the FoxPro for MS-DOS "Developers Guide" give samples for
           coordinating Browse windows with screens but omit the SAVE clause in
           the example. If the optional BROWSE parameter SAVE is omitted, the
           Browse window will close as soon as any other object is clicked.
    

           The code examples should be changed to read as follows:
    

              IF NOT WVISIBLE("Client List")
                 BROWSE NORMAL NOWAIT NODELETE LAST TITLE "Client List" ;
                    NOAPPEND NOMENU SAVE FIELDS company ;
                    WHEN showgets()
              ENDIF
    
              IF NOT WVISIBLE("Account Details")
                 SELECT details
                    BROWSE NORMAL NOWAIT NODELETE LAST TITLE "Client List" ;
                       NOAPPEND NOMENU SAVE  ;
                       FIELDS ;
                       Trans_type:10, ;
                       Trans_date:10, ;
                       Amt:7,Service
                 SELECT clients
              ENDIF
    
    

  2. Q. Are the keyboard shortcuts for the FoxPro for Windows Screen Builder

           documented?
    

        A. FoxPro for Windows requires a mouse. In a graphical environment such
           as Windows, the mouse provides a more effective means of locating
           and/or moving objects than the keyboard does.
    

           To complete the transition from designing with the keyboard to
           designing with the mouse, icons have been added for every tool in
           the Screen Builder. These icons take the place of the menu shortcuts
           that exist in FoxPro for MS-DOS.
    

PART 4: PRINTER DRIVER QUESTIONS

  1. Q. How do I use @ ... SAY Commands and control codes to print in FoxPro

           for Windows?
    

        A. FoxPro for Windows cannot send control codes directly to a printer
           using a Windows printer driver. There are two techniques you can use
           to work around this:
    

            - Open the printer in "raw mode," bypassing the Windows printer
              driver and communicating directly with the printer.
    
              -or-
    
            - Write all output to a text file, then copy the text file to a
              printer port.
    
           Writing FoxPro for Windows programs that send control codes directly
           to a printer is not normally recommended. Only use these techniques
           when adapting existing FoxPro for MS-DOS code that sends control
           codes to the printer.
    
           The following examples send control codes to switch an Epson FX-80
           dot-matrix printer's compressed mode on and off.
    
           NOTE: When using these techniques, do not use any of the ? or ??
           commands for output. Only use @ ... SAY commands.
    
           Technique 1: Open the Printer in Raw Mode
           -----------------------------------------
    
           There are two ways to open the printer in raw mode:
    
            - Use the ??? " " command.
    
              -or-
    
            - Use the SET PDSETUP TO <driver name> command.
    
    
           Use the ??? " " Command:
    
           Issue SET DEVICE TO PRINT and SET PRINTER TO commands to turn off
           all open print commands.
    
           Issue a ??? " " command to open the printer in raw mode.
    
           Issue @ ... SAY commands to send control codes and text to the
           printer.
    
           After printing, issue a SET PRINTER TO command to flush the print
           buffer and return control to the Windows printer driver.
    
              SET PRINTER TO
              SET PDSETUP TO "Epson"
              SET PRINTER ON
              SET DEVICE TO PRINT
    
              @ 1, 0 SAY 'NORMAL text'
              @ 2, 0 SAY  CHR(15)   && Control code to turn compressed mode on
              @ 2, 0 SAY  'CONDENSED text'
              @ 3, 0 SAY  CHR(18)   && Control code to turn compressed mode off
              @ 3, 0 SAY 'normal again'
    
              SET DEVICE TO SCREEN
              SET PRINTER OFF
              SET PRINTER TO
    
           NOTE: In some circumstances, the last @ ... SAY command may not
           print. If this problem occurs, add an additional @ ... SAY command
           that prints a blank line (so that the lost line is just a blank).
    
    
           Use the SET PDSETUP TO <Driver Name> Command:
    
           Issue a SET PRINTER TO command to clear the print buffer of all open
           print commands.
    
           Issue a SET PDSETUP TO <driver name> command to open the printer in
           raw mode. You MUST already have an existing FoxPro version 2.0, 2.5,
           or 2.6 for MS-DOS printer driver in the current resource file.
    
           NOTE: The important property of this command is that setting a
           FoxPro for MS-DOS printer driver opens the printer in raw mode. The
           printer driver itself is not used to control printing (that is done
           though control codes). In fact, any FoxPro for MS-DOS printer driver
           can be used.
    
           Issue a SET DEVICE TO PRINTER command to direct the @ ... SAY
           commands to the printer.
    
           Issue @ ... SAY commands to send control codes and text to the
           printer.
    
           After printing, issue a SET DEVICE TO SCREEN command to redirect the
           output to the screen.
    
           Issue a SET PRINTER TO command to flush the print buffer and return
           control to the Windows printer driver.
    
           The following code demonstrates these steps:
    
              SET PRINTER TO
              SET PDSETUP TO "Epson"
              SET DEVICE TO PRINT
    
              @ 1, 0 SAY 'NORMAL text'
              @ 2, 0 SAY  CHR(15) && Control code to turn compressed mode on
              @ 2, 0 SAY  'CONDENSED text'
              @ 3, 0 SAY  CHR(18) && Control code to turn compressed mode on
              @ 3, 0 SAY 'normal again'
    
              SET DEVICE TO SCREEN
              SET PRINT TO
    
           Technique 2: Write to Text File and Copy to Printer Port
           --------------------------------------------------------
    
           Issue a SET DEVICE TO FILE <filename> command to direct output to a
           file.
    
           Issue @ ... SAY commands to send control codes or text to the
           printer.
    
           Issue a SET DEVICE TO SCREEN command to redirect output to the
           screen.
    
           Issue a SET SAFETY OFF command so FoxPro for Windows does not
           confirm copying the output file to the printer port (which it
           believes to be a file).
    
           Issue a COPY FILE <filename> TO <printer port>.DOS command to copy
           the output file to the printer port.
    
           Issue a SET SAFETY ON command to turn safety on again.
    
           The following code demonstrates these steps:
    
              SET DEVICE TO FILE output.prn
    
              @ 1,0 SAY 'NORMAL text'
              @ 2,0 SAY CHR(15) && Control code to turn compressed mode on
              @ 2,0 SAY 'CONDENSED text'
              @ 3, 0 SAY CHR(18) && Control code to turn compressed mode off
              @ 3, 0 SAY 'Back to normal text'
    
              SET DEVICE TO SCREEN
              SET SAFETY OFF
              COPY FILE output.prn TO lpt1.dos
              SET SAFETY ON
    
           When Windows prints to a file named LPT1.DOS, MS-DOS interprets the
           request to open the file LPT1.DOS as a request to send data to the
           printer port, and it sends the data out through its own printing
           handler. Because Windows thinks that LPT1.DOS is an MS-DOS file, the
           Print Manager is not used.
    
    

  2. Q. How can I edit an existing MS-DOS-style printer driver or create a

           new one?
    

        A. In FoxPro for Windows, the SET PDSETUP TO <driver_name> command
           selects only an existing MS-DOS-style printer driver. It cannot edit
           an existing MS-DOS-style printer driver or create a new one.
    

           To use the SET PDSETUP TO <driver_name> command in FoxPro for
           Windows, the current resource file (by default FOXUSER.DBF and its
           associated memo file, FOXUSER.FPT) must already have an MS-DOS-style
           printer driver loaded. This MS-DOS-style printer driver must have
           been previously created by FoxPro for MS-DOS.
    

           FoxPro for Windows normally uses Windows printer drivers for all of
           its printing. Windows printer drivers are modified through the
           Windows Control Panel.
    

           Only use the SET PDSETUP TO <driver_name> command with character-
           based reports that were created in FoxPro for MS-DOS.
    

           NOTE: The SET PDSETUP <driver_name> command has no effect on Windows
           printer drivers.
    

  3. Q. How can I invoke the Windows Printer Driver Setup dialog box from a

           program?
    

        A. There are two methods to invoke the Windows Printer Driver Setup
           dialog box:
    

            - The first method is to use the new function SYS(1037).
    
              SYS(1037) is for use in FoxPro for Windows and Macintosh 2.6x.
              SYS(1037) displays the Print Setup dialog box, allowing you to
              make adjustments to printer settings such as the paper size and
              orientation. The settings you can adjust in this dialog box
              depend on the printer driver you've installed. You can also
              choose Print Setup from the File menu to display the FoxPro Print
              Setup dialog box.
    
              NOTE: SYS(1037) always returns a null string.
    
            - The second method is to use a RUN command. The following example
              illstrates this:
    
                 RUN /N control printers
    
              NOTE: This command will not work with Windows version 3.0. For
              example, the RUN /N CONTROL.EXE PRINTERS command will only run
              the Control Panel in Windows 3.0; it will not open the Printer
              Setup dialog box.
    


Additional reference words: FoxWin 2.60 q&a XPlatForm SBuilder
KBCategory: kbother kbprint kbinterop kbsetup kbprg kbcode kbtshoot
KBSubcategory: FxotherGeneral


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.