Printing Graphics and Text

Printing from a Windows program usually involves more overhead than shown in the FORMFEED program, as well as some GDI calls to actually print something. Let’s write a program that prints one page of text and graphics. We’ll start with the method shown in the FORMFEED program and then add some enhancements. We’ll be looking at three versions of this program called PRINT1, PRINT2, and PRINT3. To avoid a lot of duplicated source code, each of these programs will use the GETPRNDC.C file shown earlier and functions contained in the PRINT.C file, which is shown in Example 13-4.

Example 13-4. The PRINT.C file used in the PRINT1, PRINT2, and PRINT3 programs.

PRINT.C /*----------------------------------------------------------- ...

Get Programming Windows®, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.