OWLNext 7.0
Borland's Object Windows Library for the modern age
|
The easiest way to create a printer object is to declare a TPrinter* in your window object that other objects in the program can use for their printing needs.
To make the printer available, make Printer point to an instance of TPrinter. This can be done in the constructor:
You should also eliminate the printer object in the destructor:
Here is how it is done in the PRINTING.CPP example from directory CLASSES\PRINTING:
For most applications, this is sufficient. The application's main window initializes a printer object that uses the default printer specified in WIN.INI. In some cases, however, you might have applications that use different printers from different windows simultaneously. In that case, construct a printer object in the constructors of each of the appropriate windows, then change the printer device for one or more of the printers. If the program uses different printers but not at the same time, it is probably best to use the same printer object and select different printers as needed.