Printing the Screen from Within a Program in FoxPro

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

SUMMARY

Sometimes the need arises to make a hard copy of each screen being processed for remote confirmation, or to provide a quick audit trail for data entry. Rather than rely on the operator remembering to press the PRINT SCREEN button at the proper moment, the following method allows the screen to be printed automatically from within the program.

NOTE: The following information requires experience in writing .BIN routines using the MS-DOS Debug program.

MORE INFORMATION

Use the following code to create the .BIN routine. Do not type the hyphens, semicolons, or explanations following the semicolons.

   C:\>debug             ; At the MS-DOS prompt, type DEBUG.
   -nPR_OUT.BIN          ; Provide a filename with a BIN extension.
   -a 100                ; Assemble at address 100.
                         ;
                         ; The address segment after the colon is
                         ; significant--the first 4 numbers may differ.
   2883:0100 INT 05      ; Call the ROM BIOS print screen interrupt.
   2883:0103 RETF        ; All FoxPro-called routines use far returns.
   2883:0104             ; Press ENTER at the blank line.
                         ;
   -rcx                  ; Access the count register.
   cx 0000               ; Disregard whatever's here because it will
   :3                    ; be changed to 3 bytes.
   -w                    ; Write the program to disk.
   Writing 0003 bytes    ; Message confirms write.
   -q                    ; Quit to MS-DOS.

To use PR_OUT.BIN, load it early in the program, and then call it at the points where output to the printer is completed. For example:

   CLEAR
   LOAD pr_out             && Loads PR_OUT.BIN.
   *
   && Represents code in program that produces display screen--
   && this example uses direct output to the screen with a ?.
   *
   ? "SCREEN OUTPUT EXAMPLE..."
   *
   && The call to print could be placed in the VALID clause of a Save
   && push button--in this case, the screen is printed immediately.
   *
   CALL pr_out             && Begin printing screen.
   *
   && Loop to process more screens if needed, but this example is done.

   RELEASE MODULE pr_out   && Remove PR_OUT.BIN from memory when done.


Additional reference words: FoxDos 2.00 2.50 2.50a print screen
KBCategory: kbprint kbdisplay kbui 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 17, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.