The DEVMODE data structure contains information about the device initialization and environment of a printer driver. An application passes this structure to the Device-Capabilities and ExtDeviceMode functions.
typedef struct _devicemode {
char dmDeviceName[32];
WORD dmSpecVersion;
WORD dmDriverVersion;
WORD dmSize;
WORD dmDriverExtra;
DWORD dmFields;
short dmOrientation;
short dmPaperSize;
short dmPaperLength;
short dmPaperWidth;
short dmScale;
short dmCopies;
short dmDefaultSource;
short dmPrintQuality;
short dmColor;
short dmDuplex;
BYTE dmDriverData[dmDriverExtra];
} DEVMODE;
The DEVMODE structure contains the following fields:
Field | Description | ||
dmDeviceName | Specifies the name of the device the driver supports; for example, “PCL/HP LaserJet” in the case of PCL/HPÒ LaserJetÒ. This string is unique among device drivers. | ||
dmSpecVersion | Specifies the version number of the initialization data specification upon which the structure is based. The version number follows the Windows version number and is currently 0x300. | ||
dmDriverVersion | Specifies the printer driver version number assigned by the printer driver developer. | ||
dmSize | Specifies the size in bytes of the DEVMODE structure except the dmDriverData (device-specific) field. If an application manipulates only the driver-independent portion of the data, it can use this field to determine the length of the structure without having to account for different versions. | ||
dmDriverExtra | Contains the size of the dmDriverData field and is the length of the device-specific data in the DEVMODE structure. If an application does not use device-specific information, it should set this field to zero. | ||
dmFields | Is a bitfield that specifies which of the remaining fields in the DEVMODE structure have been initialized. Bit 0 (defined as DM_ORIENTATION) corresponds to dmOrientation; bit 1 (defined as DM_PAPERSIZE) specifies dmPaperSize, and so on. A printer driver supports only those fields that are appropriate for the printer technology. | ||
dmOrientation | Selects the orientation of the paper. It can be either DMORIENT_PORTRAIT (1) or DMORIENT_LAND-SCAPE (2). | ||
dmPaperSize | Selects the size of the paper to print on. This field may be set to zero if the length and width of the paper are both set by the dmPaperLength and dmPaperWidth fields. Otherwise, the dmPaperSize field can be set to one of the following predefined values: | ||
Value | Meaning | ||
DMPAPER_LETTER | 81/2-by-11-inch paper | ||
DMPAPER_LEGAL | 81/2-by-14-inch paper | ||
DMPAPER_A4 | 210-by-297-millimeter paper | ||
DMPAPER_CSHEET | 17-by-22-inch paper | ||
DMPAPER_DSHEET | 22-by-34-inch paper | ||
DMPAPER_ESHEET | 34-by-44-inch paper | ||
DMPAPER_ENV_9 | 37/8-by-87/8-inch #9 envelope | ||
DMPAPER_ENV_10 | 41/8-by-91/5-inch #10 envelope | ||
DMPAPER_ENV_11 | 41/2-by-103/8-inch #11 envelope | ||
DMPAPER_ENV_12 | 43/4-by-11-inch #12 envelope | ||
DMPAPER_ENV_14 | 5-by-111/2-inch #14 envelope | ||
dmPaperLength | Overrides the length of the paper specified by the dmPaperSize field, either for custom paper sizes or for devices such as dot-matrix printers which can print on a page of arbitrary length. These values, along with all other values which specify a physical length, are in tenths of a millimeter. | ||
dmPaperWidth | Overrides the width of the paper specified by the dmPaperSize field. | ||
dmScale | Scales the printed output. The apparent page size is scaled by a factor of dmScale/100 from the physical page size. A letter-size paper with a dmScale value of 50 would appear to be 17 by 22 inches, and output text and graphics would be correspondingly half their normal height and width. | ||
dmCopies | Selects the number of copies printed if the device supports multiple-page copies. | ||
dmDefaultSource | Specifies the paper bin from which the paper is fed by default. The application can override this selection by using the GETSETPAPERBINS escape. Possible bins include the following: | ||
DMBIN_DEFAULT DMBIN_UPPER DMBIN_LOWER DMBIN_MANUAL DMBIN_TRACTOR DMBIN_ENVELOPE |
|||
There is also a range of values reserved for device-specific bins. The GETSETPAPERBINS and ENUMPAPERBINS escapes use these indexes to be consistent with initialization information. | |||
dmPrintQuality | Specifies the printer resolution. There are four predefined device-independent values: | ||
DMRES_HIGH (–4) DMRES_MEDIUM (–3) DMRES_LOW (–2) DMRES_DRAFT (–1) |
|||
If a positive value is given, it specifies the number of dots per inch (DPI) and is therefore device dependent. | |||
dmColor | Switches between color and monochrome on color printers. Possible values are: | ||
DMCOLOR_COLOR (1) | |||
DMCOLOR_MONOCHROME (2). | |||
dmDuplex | Selects duplex or double-sided printing for printers capable of duplex printing. Values for this field include: | ||
DMDUP_SIMPLEX (1) | |||
DMDUP_HORIZONTAL (2) | |||
DMDUP_VERTICAL (3). | |||
dmDriverData[ ] | Contains device-specific data defined by the device driver. |
Only drivers fully updated for Windows version 3.0 and which export the ExtDeviceMode function use the DEVMODE data structure.