DEVMODE
typedef struct _DEVMODE {
char dmDeviceName[CCHDEVICENAME];
UINT dmSpecVersion;
UINT dmDriverVersion;
UINT dmSize;
UNIT dmDriverExtra;
DWORD dmFields;
int dmOrientation;
int dmPaperSize;
int dmPaperLength;
int dmPaperWidth;
int dmScale;
int dmCopies;
int dmDefaultSource;
int dmPrintQuality;
int dmColor;
int dmDuplex;
int dmYResolution;
int dmTTOption;
int dmCollate;
TCHAR dmFormName[CCHFORMNAME];
WORD dmLogPixels;
DWORD dmBitsPerPel;
DWORD dmPelsWidth;
DWORD dmPelsHeight;
DWORD dmDisplayFlags;
DWORD dmDisplayFrequency;
DWORD dmICMMethod;
DWORD dmICMIntent;
DWORD dmMediaType;
DWORD dmDitherType;
DWORD dmReserved1;
DWORD dmReserved2;
} DEVMODE;
Structure that contains information about the device initialization and environment of a printer. An application passes this structure to DeviceCapabilities and ExtDeviceMode functions exported by the driver. The DEVMODE structure is defined in PRINT.H.
DEVMODE members which are new to Windows 95 are defined below.
dmCollate |
Specifies whether collation should be used when printing multiple copies. This member can have one of the following values: |
Value |
Meaning |
DMCOLLATE_TRUE |
Collate when printing multiple copies. |
DMCOLLATE_FALSE |
Do not collate when making multiple copies. |
Using DMCOLLATE_FALSE provides faster, more efficient output, since the data is sent to a page printer just once, no matter how many copies are required, and the printer is instructed to simply print the page again.
dmFormName |
This member is unused for the first release of Windows 95. |
dmLogPixels |
Specifies the number of log pixels in the x direction. The value in this member should be equal to the value in the uLogPixels member of the GDIINFO structure. |
dmBitsPerPel |
Unused for printers. For display devices, specifies in bits per pixel the color resolution of the device. |
dmPelsWidth |
Unused for printers. For display devices, specifies the width, in pixels, of the visible device surface. |
dmPelsHeight |
Unused for printers. For display devices, specifies the height, in pixels, of the visible device surface. |
dmDisplayFlags |
Unused for printers. For display devices, specifies the display mode of the device. |
dmDisplayFrequency |
Unused for printers. For display devices, specifies the frequency of the device in particular modes. |
dmICMMethod |
Specifies which component, if any, will create the ICM color dictionaries. This member can have one of the following values: |
Value |
Meaning |
DMICMMETHOD_SYSTEM |
The Windows 95 System ICM library performs color matching. |
DMICMMETHOD_NONE |
ICM is disabled. |
DMICMMETHOD_DRIVER |
The driver performs color matching. |
DMICMMETHOD_DEVICE |
The device performs color matching. |
The printer driver must provide a user interface for setting the dmICMMethod member of the DEVMODE structure. Most printer drivers support only the DMICMMETHOD_SYSTEM or DMICMMETHOD_NONE methods, although drivers for PostScript printers support all values.
dmICMIntent |
Specifies the ICM setting to be used for a particular document. This information is used to select specific color-matching algorithms. This member can have one of the following values: |
Value |
Meaning |
DMICM_SATURATE |
Optimizes for color saturation. Generally used for high-contrast presentation graphics when dithering is not desired. |
DMICM_CONTRAST |
Optimizes for color contrast. Generally used for photographic images when dithering is desired. |
DMICM_COLORMETRIC |
Optimizes to match an exact given color. Used when a particular color must be respected. |
The dmICMIntent member of the DEVMODE structure is used primarily by applications that do not support ICM. ICM-capable functions can establish color-matching algorithms by using the ICM functions.
dmMediaType |
Specifies the type of media being printed on. The ICM library uses this information to compensate for different absorption of varying media. This member can have one of the following values: |
Value |
Meaning |
DMICM_STANDARD |
Plain paper. |
DMICM_TRANSPARENCY |
Transparencies. |
DMICM_GLOSSY |
Glossy paper. |
A driver can define values for this member that are greater than the value DMMEDIA_USER.
dmDitherType |
Specifies the dither brush to be used for a particular document. The choice of brush will generally affect the available colors for the device. This member can have one of the following predefined values, or a driver can define a value for this member that is greater than DMDITHER_USER. |
Value |
Meaning |
DMDITHER_NONE |
Colors will not be dithered. |
DMDITHER_COARSE |
Dither with a coarse brush. Perform ordered, or halftone, dithering. Suitable for scanned photographs or other images that have continuous gradations in intensity and hue. |
DMDITHER_FINE |
Dither with a fine brush. Perform ordered, or halftone, dithering. Suitable for scanned photographs or other images that have continuous gradations in intensity and hue. |
DMDITHER_LINEART |
Line art dithering, which produces well-defined borders between black, white, and gray scalings. Not suitable for scanned photographs or other images that have continuous gradations in intensity and hue. |
DMDITHER_ERRORDIFFUSION |
Error diffusion dithering. Can preserve more detail of an image that has continuous gradations in intensity and hue than ordered, or halftone, dithering does. |
DMDITHER_GRAYSCALE |
Device does gray scaling. |
dmReserved1 |
Not used; must be zero. |
dmReserved2 |
Not used; must be zero. |
Printer drivers that support the new members in the DEVMODE structure must set DEVMODE.dmSpecVersion to 0x0400. If a driver sets DEVMODE.dmSpecVersion to this value, the driver must also meet the following requirements:
- The driver must always return 0x0400 to a DeviceCapabilities function call that uses a DC_VERSION argument.
- The driver must use the new DEVMODE structure definition, even if it does not use any of the new members (it should initialize them to zero).
- The driver must use DrvSetPrinterData to store printer driver settings and use DrvGetPrinterData to retrieve them.
- The driver must be able to handle friendly user-defined printer names, which can be any string up to 32 characters in length (including the terminating NULL character). When an application passes the driver a friendly printer name, the driver must query the registry to determine what the corresponding printer model name is. The driver can use the DrvGetPrinterData function to do this.
- If the DEVMODE data retrieved from the registry is incorrect, the driver must build a default DEVMODE and merge as many member values as possible, and then update the registry. Win32 applications can use the DEVMODE structure, so the driver must update DEVMODE.dmDeviceName with the current friendly printer name.
- Private DEVMODE data must contain the printer model name or some way of determining the current printer model name.
- The driver does not have to contain code that writes settings to INI files since these settings are now maintained on the registry. The driver may have to contain code that reads INI files.
In addition to the requirements listed above, there are two other more detailed requirements which are described below:
- The driver must handle brushes differently than in Windows 3.x.
- The driver must organize the private members of the DEVMODE structure into two groups: printer-sticky members and document-sticky members.