This section explains how to add printing capability to the EditFile application, described in Chapter 10, “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, modify the EditFile application as follows:
1.Add an AbortDlg dialog box template to the resource-definition file.
2.Add new variables for printing.
3.Add an IDM_PRINT case to the WM_COMMAND case.
4.Create the AbortDlg dialog box procedure and the AbortProc function.
5.Add a GetPrinterDC function.
6.Export the AbortDlg dialog box procedure and AbortProc function.
7.Compile and link the application.
This example shows how to print the contents of the edit control, including the statements required to support the print-canceling function and the dialog box procedure for the Abort dialog box.