This section explains how to add printing capability to the EditFile application, described in Chapter 22, “File Input and Output,” by copying the current text from the edit control and printing it by using the methods described in this chapter. To add printing capability, copy and rename the EditFile sources to PrntFile, then modify the sources as follows:
1.Add an AbortDlg dialog-box template to the resource script file.
2.Add new variables for printing.
3.Add the IDM_PRINT case to the WM_COMMAND case.
4.Create the AbortDlg dialog function and AbortProc function.
5.Add the GetPrinterDC function.
6.Export the AbortDlg dialog function and AbortProc function.
7.Build and run the application.
This example shows how to print the contents of the edit control, including the statements required to support the abort function and the dialog function for the Abort dialog box.
NOTE:
Rather than typing the code provided in the following sections, you might find it more convenient to simply examine and build the sample source files provided on the sample disks.