Printing the Window Contents

You can send the character contents of the window image to the printer with the window image print function, wn_print():

int wn_print(image_part, wnp)
 
int image_part;
/* image_part: PRINT_FULL or PRINT_INSIDE 
*/
WINDOWPTR wnp;
/* Pointer to a window structure
*/

This function copies the character contents of the window image to the printer. You can print either the full window image, including borders and margins, or just the interior work area of the window.

The printer specifications are global variables. The default depends on the operating system. For PCDOS, the printer file is set to "prn" and uses the "w" mode of file operation. For UNIX and POSIX, "lpr" is used as the printer file, and "p" is the mode. For VMS, "SYS$PRINT" is used as the printer file, and "w" is the mode. You can change this with:

void se_printer(filename, dmode)
 
UCHAR *filename;
/* Printer file name
*/
UCHAR *dmode;
/* Disk mode for opening printer file
*/

The dmode parameter specifies whether the file is to be opened in the "w" mode, which overwrites the contents of the specified file, or "a" mode, which appends the copied information to the existing information in the file. For UNIX and POSIX systems, you can specify "p" for dmode to open a pipe to the shell command specified as the filespec. These are the same arguments used in the fopen() call. See your compiler manual for more information.

The image_part parameter specifies what dimensions of the window you wish to print. Use PRINT_INSIDE to specify just the work area of the window, or PRINT_FULL to indicate the entire window including the border and the margins.

Because wn_print() copies the window image directly from the window's destination screen, the image will include children windows and even pieces of overlapping windows (if any exist). If this is not what you want, use sw_dest() before wn_print() to isolate the window image. For more information about this, see the section on sw_dest() in Chapter 28, "Advanced Window Management."


Home Contents Previous Next