OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Choosing a Different Printer

You can associate the printer objects in your applications with any printer device installed in Windows.

By default, TPrinter uses the Windows default printer, as specified in the [devices] section of the WIN.INI file.

There are two ways to specify an alternate printer: through a user dialog box and directly in code.

Choosing and Configuring with a User Dialog Box

A common way to assign a different printer is to bring up a dialog box that gives the user the ability to choose from a list of installed printer devices. TPrinter does this automatically when you call its TPrinter::Setup member function. Setup displays a dialog box based on TPrinterDialog.

One of the buttons in the printer dialog allows the user to change the printer's configuration. The Setup button brings up a configuration dialog box defined in the printer's device driver. Your application has no control over the appearance or function of the driver's configuration dialog box.

Assigning a Printer directly

In some cases, you might want to assign a specific printer device to your printer object, without user input. TPrinter has a TPrinter::SetPrinter member function that does just that. SetPrinter takes three strings as parameters: a device name, a driver name, and a port name.

See Also