Printing the Screen from Within a Program in FoxPro

ID: Q98750


The information in this article applies to:


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 query words: FoxDos print screen


Keywords          : 
Version           : 
Platform          : 
Issue type        : 

Last Reviewed: August 8, 1999