typedef struct _DEVMODEW {
WCHAR dmDeviceName[CCHDEVICENAME];
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;
short dmYResolution;
short dmTTOption;
short dmCollate;
WCHAR dmFormName[CCHFORMNAME];
WORD dmLogPixels;
DWORD dmBitsPerPel;
DWORD dmPelsWidth;
DWORD dmPelsHeight;
DWORD dmDisplayFlags;
DWORD dmDisplayFrequency;
} DEVMODEW;
The DEVMODEW structure contains information about the device initialization and environment of a printer.
Members
dmDeviceName
Specifies the name of the device the driver supports; for example, “PCL/HP LaserJet” in the case of PCL/HP LaserJet®. If the name is greater than CCHDEVICENAME characters in length, the spooler truncates it to fit in the array.
dmSpecVersion
Specifies the version number of the initialization data specification on which the structure is based.
dmDriverVersion
Specifies the printer driver version number assigned by the printer driver developer.
dmSize
Specifies the size, in bytes, of the DEVMODEW structure minus the device-specific dmDriverData member. If an application manipulates only the driver-independent portion of the data, it can use this member to determine the size of the structure without having to account for different versions.
dmDriverExtra
Specifies the number of bytes of private driver data that follow this structure. If a device driver does not use device-specific information, this member should be set to zero.
dmFields
Specifies which of the remaining members in the DEVMODEW structure have been initialized. Bit zero (defined as DM_ORIENTATION) specifies dmOrientation; bit one (defined as DM_PAPERSIZE) specifies dmPaperSize, and so on. A printer driver should support only those members that are appropriate for the printer technology.
dmOrientation
Specifies the paper orientation. This member can be either DMORIENT_PORTRAIT or DMORIENT_LANDSCAPE.
dmPaperSize
Specifies the size of the paper to be printed on. This member can be zero if the length and width of the paper are both specified by the dmPaperLength and dmPaperWidth members. Otherwise, the dmPaperSize member can be set to one of the following predefined values:
Value | Meaning |
DMPAPER_LETTER | Letter, 8-1/2 by 11 in. |
DMPAPER_LEGAL | Legal, 8-1/2 by 14 in. |
DMPAPER_A4 | A4 Sheet, 210 by 297 mm. |
DMPAPER_CSHEET | C Sheet, 17 by 22 in. |
DMPAPER_DSHEET | D Sheet, 22 by 34 in. |
DMPAPER_ESHEET | E Sheet, 34 by 44 in. |
DMPAPER_LETTERSMALL | Letter Small, 8-1/2 by 11 in. |
DMPAPER_TABLOID | Tabloid, 11 by 17 in. |
DMPAPER_LEDGER | Ledger, 17 by 11 in. |
DMPAPER_STATEMENT | Statement, 5-1/2 by 8-1/2 in. |
DMPAPER_EXECUTIVE | Executive, 7-1/4 by 10-1/2 in. |
DMPAPER_A3 | A3 sheet, 297 by 420 mm. |
DMPAPER_A4SMALL | A4 small sheet, 210 by 297 mm. |
DMPAPER_A5 | A5 sheet, 148 by 210 mm. |
DMPAPER_B4 | B4 sheet, 250 by 354 mm. |
DMPAPER_B5 | B5 sheet, 182 by 257 mm. |
DMPAPER_FOLIO | Folio, 8-1/2 by 13 in. |
DMPAPER_QUARTO | Quarto, 215 by 275 mm. |
DMPAPER_10X14 | 10 by 14 in. |
DMPAPER_11X17 | 11 by 17 in. |
DMPAPER_NOTE | Note, 8-1/2 by 11 in. |
DMPAPER_ENV_9 | #9 Envelope, 3-7/8 by 8-7/8 in. |
DMPAPER_ENV_10 | #10 Envelope, 4-1/8 by 9-1/2 in. |
DMPAPER_ENV_11 | #11 Envelope, 4-1/2 by 10-3/8 in. |
DMPAPER_ENV_12 | #12 Envelope, 4-3/4 by 11 in. |
DMPAPER_ENV_14 | #14 Envelope, 5 by 11-1/2 in. |
DMPAPER_ENV_DL | DL Envelope, 110 by 220 mm. |
DMPAPER_ENV_C5 | C5 Envelope, 162 by 229 mm. |
DMPAPER_ENV_C3 | C3 Envelope, 324 by 458 mm. |
DMPAPER_ENV_C4 | C4 Envelope, 229 by 324 mm. |
DMPAPER_ENV_C6 | C6 Envelope, 114 by 162 mm. |
DMPAPER_ENV_C65 | C65 Envelope, 114 by 229 mm. |
DMPAPER_ENV_B4 | B4 Envelope, 250 by 353 mm. |
DMPAPER_ENV_B5 | B5 Envelope, 176 by 250 mm. |
DMPAPER_ENV_B6 | B6 Envelope, 176 by 125 mm. |
DMPAPER_ENV_ITALY | Italy Envelope, 110 by 230 mm. |
DMPAPER_ENV_MONARCH | Monarch Envelope, 3-7/8 by 7-1/2 in. |
DMPAPER_ENV_PERSONAL | 6-3/4 Envelope, 3-5/8 by 6-1/2 in. |
DMPAPER_FANFOLD_US | US Std Fanfold, 14-7/8 by 11 in. |
DMPAPER_FANFOLD_STD_GERMAN | German Std Fanfold, 8-1/2 by 12 in. |
DMPAPER_FANFOLD_LGL_GERMAN | German Legal Fanfold, 8-1/2 by 13 in. |
dmPaperLength
Specifies the length of the paper. This value overrides the length of the paper specified by the dmPaperSize member. This might be necessary if the paper is of a custom size, or the device is a dot matrix printer, which can print a page of arbitrary length. This value, along with all values in this structure that specify a physical length, is specified in units of 1/10 of a millimeter.
dmPaperWidth
Specifies the width of the paper. This value overrides the width of the paper specified by the dmPaperSize member. This value is specified in units of 1/10 of a millimeter.
dmScale
Specifies the factor by which the printed output is to be scaled. The apparent page size is scaled from the physical page size by a factor of dmScale/100. For example, a letter-sized page with a dmScale value of 50 contains as much data as a page of 17 by 22 inches because the output text and graphics are half their original height and width.
dmCopies
Specifies the number of copies printed if the device supports multiple copies.
dmDefaultSource
Reserved; must be zero.
dmPrintQuality
Specifies the printer resolution. There are four predefined device-independent values:
DMRES_HIGH
DMRES_MEDIUM
DMRES_LOW
DMRES_DRAFT
If a positive value is given, it specifies the number of dots per inch (DPI) and is therefore device-dependent.
dmColor
Specifies whether a color printer should print color or monochrome. This member can be one of the following values:
DMCOLOR_COLOR
DMCOLOR_MONOCHROME
dmDuplex
Specifies duplex (double-sided) printing for duplex-capable printers. This member can be one of the following values:
DMDUP_SIMPLEX
DMDUP_HORIZONTAL
DMDUP_VERTICAL
dmYResolution
Specifies the y resolution of the printer, in DPI. If the printer initializes this member, the dmPrintQuality member specifies the x resolution of the printer, in DPI.
dmTTOption
Specifies how TrueType® fonts should be printed. This member can be one of the following values:
Value | Meaning |
DMTT_BITMAP | Prints TrueType fonts as graphics. This is the default for dot-matrix printers. |
DMTT_DOWNLOAD | Downloads TrueType fonts as soft fonts. This is the default for Hewlett-Packard printers that use Printer Control Language (PCL). |
DMTT_SUBDEV | Substitute device fonts for TrueType fonts. This is the default for PostScript® printers. |
dmCollate
Specifies whether collation should be used when printing multiple copies. This member can be be one of the following values:
Value | Meaning |
DMCOLLATE_TRUE | Collate when printing multiple copies. |
DMCOLLATE_FALSE | Do not collate when printing multiple copies. |
Specifying DMCOLLATE_FALSE provides faster output because the data is sent to a printer only once, no matter how many copies are required.
dmFormName
Specifies the name of the form to use; for example, “Letter” or “Legal”. A complete set of names can be retrieved using the EnumForms function.
dmLogPixels
Specifies the number of log pixels in the x direction. This member should be equal to the ulLogPixels member of the GDIINFO structure.
dmBitsPerPel
Specifies the color resolution of the display device, in bits per pixel. For example: 4 for 16 colors, 8 for 256 colors, or 16 for 65536 colors.
dmPelsWidth
Specifies the width in pixels of the visible device surface.
dmPelsHeight
Specifies the height in pixels of the visible device surface.
dmDisplayFlags
Specifies the device’s display mode. The following are valid flags:
Value | Meaning |
DM_GRAYSCALE | Specifies that the display is not a color device. If this flag is not set, color is assumed. |
DM_INTERLACED | Specifies that the display mode is interlaced. If the flag is not set, noninterlaced is assumed. |
dmDisplayFrequency
Specifies the frequency, in hertz, of the display device in its current mode.
Comments
This structure is an extension of the Windows 3.1 DEVMODE structure.
A device driver’s private data follows the dmDisplayMode member. The number of bytes of private data is specified by the dmDriverExtra member.
An application can set several of these members, like dmCopies and dmOrientation, that are common among several drivers. This allows an application to make simple mode selections without calling the driver-supplied DrvDeviceModes function.
The DEVMODEW structure is followed immediately by dmDriverExtra bytes of driver data. This data is set only by DrvGetModes, and is therefore driver-defined. The driver should not assume that it can calculate the size of the DEVMODEW structure, but instead should use the size specified by the dmSize member.
The driver data begins at the address pointed to by:
PVOID pvDriverData = (PVOID) (((BYTE *) pdm) + (pdm->dmSize));
See Also