◄Up► ◄Next► ◄Previous► ──────────────────────────────────────────────────────────────────────────── Printer-driver initialization occurs whenever Windows or a Windows application loads the printer driver using the LoadLibrary function (KERNEL.95). Windows loads a printer driver whenever an application uses the CreateDC function (GDI.53) to create a device context for the printer. Windows applications load the driver to prepare for subsequent calls to the printer driver's DeviceMode, ExtDeviceMode, or DeviceCapabilities function. As with other dynamic-link libraries, Windows calls the printer driver's initialization routine (if any) when it loads the driver. The routines of most drivers do little more than initialize the heap and load resources, such as the name of the driver's Help file. Although a driver may require additional initialization, it typically waits until GDI provides the additional information needed for this initialization when it calls the driver's Enable function. If a printer driver allocates global resources or alters the state of the system, the driver is responsible for freeing these resources and restoring the previous state before the driver terminates. Because every driver includes a WEP function that Windows calls as the driver is quitting, the printer driver can use this function to free resources and restore the system. ♦