17.2.2 Print Settings and the Printer Environment

A printer environment is a collection of print settings in memory. There can be one printer environment for each printer port. The current printer driver (whatever the user has installed for that port) creates and maintains the port's printer environment.

The settings in each port's environment are the same as those in the WIN.INI file, except that the WIN.INI information consists of character strings in a file, while the environment is the same information in the form of a DEVMODE structure in memory. Having the information in memory speeds up the process of creating a printer device context for that port.

When an application creates a printer device context without specifying its own customized print settings, Windows uses the settings in the printer environment. Because the printer environment is associated with a printer port, changes to the settings in a printer environment affect any application that does not provide its own print settings when creating a printer device context for that port.

When using printer drivers written for Windows versions 3.0 and later, an application can control the print settings to meet its own requirements; the changes need not affect other applications that are using the same port. (When using printer drivers written for earlier versions of Windows, applications can change the print settings only by changing the WIN.INI file and the printer environment; this affects all applications that use that port without providing their own print settings.)