RpPrinter & PtrDevice Class Overview

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

RpPrinter & PtrDevice Class Overview

Previous pageReturn to chapter overviewNext page

 

The PtrDevice (Printer Device) class is a complete low-level printing class.  It is a base class built completely around the Windows API.  As such, it contains many methods that allow you to manipulate Window's PRINTDLG, DEVMODE and DEVNAMES structures.

 

The PtrDevice class completely integrates the printing and print preview tasks.  When you code for the printer class, you write the report once and use the same code for both printing and print preview.  In fact, your code doesn't even have to know which activity is taking place.

 

The RpPrinter class subclasses the PtrDevice and provides additional functionality to simplify the task of hand coding reports.  The RpPrinter class is designed to allow you to create reports in a manor similar to reports created with CA-Clipper.

 

The source code for both classes is included with ReportPro in the SDK directory.  We have also provided the binary entities for both the print preview window and the printing in progress window.  The code provided is line-for-line equivalent to what we use in the ReportPro design environment.  You can even modify the code for the PrintPreview and have ReportPro use your modified PrintPreview class.

 

There are some not so obvious advantages to this approach.  As developers we are always running up against the limitations of our tools.  Report writers are no exception.  In DOS, the solution was simple, you hand coded reports that could not be done with a report writer.

 

In Windows, printing is not so simple.  Having access to our printer class provides an elegant solution to the problem.  First, use the ReportPro reporting engine for the reports that naturally lend themselves to report writers and hand code the balance using our printer classes.  Your users will not be able to tell the difference between reports created with ReportPro and your hand coded reports.  After all, your hand coded reports will use the same print interface and print preview window as we do!