4.1.4 Device-Context Management

Since Windows is a multitasking environment, more than one application may create a device context for a printer at the same time. This means GDI may direct the printer driver to initialize more than one physical device. The printer driver sets the dpDCManage member in its GDIINFO structure to specify how it will manage these requests. The driver can specify one of the following methods:

Driver allows multiple device contexts. It creates a new PDEVICE for each device context that specifies a new device and filename pair, but uses the same PDEVICE for any subsequent device contexts that specify the same device and filename pair.

Driver allows multiple device contexts, but it creates a new PDEVICE for each device context regardless of whether the device and filename pairs are the same.

Driver allows multiple device contexts but only if all device contexts have unique device and filename pairs. The driver creates a PDEVICE for each device context. The driver returns an error on any attempt to create a second device context with an existing device and filename pair.

Driver allows multiple device contexts, but only creates one PDEVICE. All device contexts share the same PDEVICE regardless of the device and filename pairs.

Driver allows only one device context. The driver returns an error on any attempt to create a second device context.

Printer drivers normally allow multiple device contexts but create new PDEVICE structures for each device context. With separate PDEVICE structures, the driver can maintain information about multiple print jobs without one job affecting the other.