typedef struct _devicemode { // dvmd TCHAR 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; TCHAR dmFormName[CCHFORMNAME]; WORD dmUnusedPadding; USHORT dmBitsPerPel; DWORD dmPelsWidth; DWORD dmPelsHeight; DWORD dmDisplayFlags; DWORD dmDisplayFrequency; WORD dmICMMethod; WORD dmICMIntent; WORD dmMediaType; WORD dmDitherType; DWORD dmReserved1; DWORD dmReserved2; } DEVMODE;
Contains information about the device initialization and environment of a printer. An application passes this structure to the DeviceCapabilities and ExtDeviceMode functions.
dmDeviceName
Name of the device that the driver supports (for example, "PCL/HP LaserJet" in the case of PCL/HP LaserJet®). This name is unique among device drivers.
dmSpecVersion
Version number of the initialization data specification on which the structure is based. The current version is 0x0400
dmDriverVersion
Printer driver version number assigned by the printer driver developer.
dmSize
Size, in bytes, of the DEVMODE structure except the dmDriverData (device-specific) member. If an application manipulates only the driver-independent portion of the data, it can use this member to determine the length of the structure without having to account for different versions.
dmDriverExtra
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 zero.
dmFields
Array of flags that determine whether the printer driver uses or ignores the remaining members in the DEVMODE structure. If a flag is set, the driver uses the value in the corresponding member; otherwise, the driver ignores it. A printer driver supports only those members that are appropriate for the printer technology. Can be a combination of these values:
Value | Meaning |
DM_ORIENTATION (0x00000001) | Use the dmOrientation member. |
DM_PAPERSIZE (0x00000002) | Use the dmPaperSize member. If dmPaperSize is set to DMPAPER_USER, an application must also include the DM_PAPERWIDTH and DM_PAPERLENGTH flags . |
DM_PAPERLENGTH (0x00000004) | Use the dmPaperLength member. Include this flag only if dmPaperSize is set to DMPAPER_USER. |
DM_PAPERWIDTH (0x00000008) | Use the dmPaperWidth member. Include this flag only if dmPaperSize is set to DMPAPER_USER. |
DM_SCALE (0x00000010) | Use the dmScale member. |
DM_COPIES (0x00000100) | Use the dmCopies member. |
DM_DEFAULTSOURCE (0x00000200) | Use the dmDefaultSource member. |
DM_PRINTQUALITY (0x00000400) | Use the dmPrintQuality member. |
DM_COLOR (0x00000800) | Use the dmColor member. |
DM_DUPLEX (0x00001000) | Use the dmDuplex member. |
DM_YRESOLUTION (0x00002000) | Use the dmYResolution member. |
DM_TTOPTION (00004000) | Use the dmTTOption member. |
DM_COLLATE (0x00008000) | Use the dmCollate member. |
DM_FORMNAME (0x00010000) | Use the dmFormName member. |
DM_UNUSED (0x00020000) | Use the dmUnusedPadding member. |
DM_BITSPERPEL (0x00040000) | Use the dmBitsPerPel member. |
DM_PELSWIDTH (0x00080000) | Use the dmPelsWidth member. |
DM_PELSHEIGHT (0x00100000) | Use the dmPelsHeight member. |
DM_DISPLAYFLAGS (0x00200000) | Use the dmDisplayFlags member. |
DM_DISPLAYFREQUENCY (0x00400000) | Use the dmDisplayFrequency member. |
DM_ICMMETHOD (0x02000000) | Use the dmICMMethod member. |
DM_ICMINTENT (0x04000000) | Use the dmICMIntent member. |
DM_MEDIATYPE (0x08000000) | Use the dmMediaType member. |
DM_DITHERTYPE (0x10000000) | Use the dmDitherType member. |
DM_RESERVED1 (0x00800000) | Use the dmReserved1 member. |
DM_RESERVED2 (0x01000000) | Use the dmReserved2 member. |
dmOrientation
Paper orientation. Can be either DMORIENT_PORTRAIT (1) or DMORIENT_LANDSCAPE (2).
dmPaperSize
Paper size. Can be one of these values:
Value | Meaning |
DMPAPER_10X14 | 10 by 14 inch sheet |
DMPAPER_11X17 | 11 by 17 inch sheet |
DMPAPER_A3 | A3 sheet, 297 by 420 millimeters |
DMPAPER_A4 | A4 sheet, 210 by 297 millimeters |
DMPAPER_A4SMALL | A4 small sheet, 210 by 297 millimeters |
DMPAPER_A5 | A5 sheet, 148 by 210 millimeters |
DMPAPER_B4 | B4 sheet, 250 by 354 millimeters |
DMPAPER_B5 | B5 sheet, 182 by 257 millimeter paper |
DMPAPER_CSHEET | C sheet, 17 by 22 inches |
DMPAPER_DSHEET | D sheet, 22 by 34 inches |
DMPAPER_ENV_10 | #10 envelope, 4 1/8 by 9 1/2 inches |
DMPAPER_ENV_11 | #11 envelope, 4 1/2 by 10 3/8 inches |
DMPAPER_ENV_12 | #12 envelope, 4 3/4 by 11 inches |
DMPAPER_ENV_14 | #14 envelope, 5 by 11 1/2 inches |
DMPAPER_ENV_9 | #9 envelope, 3 7/8 by 8 7/8 inches |
DMPAPER_ENV_B4 | B4 envelope, 250 by 353 millimeters |
DMPAPER_ENV_B5 | B5 envelope, 176 by 250 millimeters |
DMPAPER_ENV_B6 | B6 envelope, 176 by 125 millimeters |
DMPAPER_ENV_C3 | C3 envelope, 324 by 458 millimeters |
DMPAPER_ENV_C4 | C4 envelope, 229 by 324 millimeters |
DMPAPER_ENV_C5 | C5 envelope, 162 by 229 millimeters |
DMPAPER_ENV_C6 | C6 envelope, 114 by 162 millimeters |
DMPAPER_ENV_C65 | C65 envelope, 114 by 229 millimeters |
DMPAPER_ENV_DL | DL envelope, 110 by 220 millimeters |
DMPAPER_ENV_ITALY | Italy envelope, 110 by 230 millimeters |
DMPAPER_ENV_MONARCH | Monarch envelope, 3 7/8 by 7 1/2 inches |
DMPAPER_ENV_PERSONAL | 6 3/4 envelope, 3 5/8 by 6 1/2 inches |
DMPAPER_ESHEET | E sheet, 34 by 44 inches |
DMPAPER_EXECUTIVE | Executive, 7 1/4 by 10 1/2 inches |
DMPAPER_FANFOLD_LGL_GERMAN | German legal fanfold, 8 1/2 by 13 inches |
DMPAPER_FANFOLD_STD_GERMAN | German standard fanfold, 8 1/2 by 12 inches |
DMPAPER_FANFOLD_US | U.S. standard fanfold, 14 7/8 by 11 inches |
DMPAPER_FOLIO | Folio, 8 1/2 by 13 inch paper |
DMPAPER_LEDGER | Ledger, 17 by 11 inches |
DMPAPER_LEGAL | Legal, 8 1/2 by 14 inches |
DMPAPER_LETTER | Letter, 8 1/2 by 11 inches |
DMPAPER_LETTERSMALL | Letter small, 8 1/2 by 11 inches |
DMPAPER_NOTE | Note, 8 1/2 by 11 inches |
DMPAPER_QUARTO | Quarto, 215 by 275 millimeter paper |
DMPAPER_STATEMENT | Statement, 5 1/2 by 8 1/2 inches |
DMPAPER_TABLOID | Tabloid, 11 by 17 inches |
DMPAPER_USER | Programmer-defined paper size. The dmPaperLength and dmPaperWidth members must specify the size. |
dmPaperLength
Length of the paper, in portrait mode. Use this member to define 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 in this structure that specify a physical length, are in tenths of a millimeter. The dmPaperSize member must specify the DMPAPER_USER value; otherwise, this member is ignored.
dmPaperWidth
Width of the paper, in portrait mode. The dmPaperSize member must specify the DMPAPER_USER value; otherwise, this member is ignored.
dmScale
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 would contain as much data as a page of 17- by 22-inches because the output text and graphics would be half their original height and width.
dmCopies
Number of copies printed if the device supports multiple-page copies.
dmDefaultSource
Default paper bin from which the paper is fed. Can be one of the following predefined values, or a driver defined value greater than the value of DMBIN_USER.
DMBIN_AUTO (7) |
|
DMBIN_CASSETTE (14) |
|
DMBIN_ENVELOPE (5) |
|
DMBIN_ENVMANUAL (6) |
|
DMBIN_LARGECAPACITY (11) |
|
DMBIN_LARGEFMT (10) |
|
DMBIN_LOWER (2) |
|
DMBIN_MANUAL (4) |
|
DMBIN_MIDDLE (3) |
|
DMBIN_ONLYONE (1) |
|
DMBIN_SMALLFMT (9) |
|
DMBIN_TRACTOR (8) |
|
DMBIN_UPPER (1) |
|
dmPrintQuality
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
Color flag. Selects either color or monochrome on color printers. Can be one of these values:
DMCOLOR_COLOR (2) |
|
DMCOLOR_MONOCHROME (1) |
|
dmDuplex
Duplex flag. Selects duplex or double-sided printing for printers capable of duplex printing. Can be one of these values:
DMDUP_SIMPLEX (1) |
|
DMDUP_HORIZONTAL (3) |
|
DMDUP_VERTICAL (2) |
|
dmYResolution
Vertical resolution, in dots per inch, of the printer. If the printer initializes this member, the dmPrintQuality member specifies the horizontal resolution, in dots per inch, of the printer.
dmTTOption
TrueType® flag. Specifies how TrueType fonts should be printed. Can be one of these values:
Value | Meaning |
DMTT_BITMAP (1) | Prints TrueType fonts as graphics. This value is the default action for dot-matrix printers. |
DMTT_DOWNLOAD (2) | Downloads TrueType fonts as soft fonts. This value is the default action for Hewlett-Packard printers that use Printer Control Language (PCL). |
DMTT_SUBDEV (3) | Substitutes device fonts for TrueType fonts. This value is the default action for PostScript® printers. |
DMTT_DOWNLOAD_OUTLINE (4) | Downloads TrueType fonts as outline soft fonts. |
dmCollate
Collate flag. Specifies whether collation should be used when printing multiple copies. Can be one of these values:
Value | Meaning |
DMCOLLATE_TRUE (1) | Collates when printing multiple copies. |
DMCOLLATE_FALSE (0) | Does not collate when printing 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. The printer is simply told to print the page again.
dmFormName
Name of the form to use (for example, "Letter" or "Legal"). A complete set of names can be retrieved by using the EnumForms function.
dmUnusedPadding
Reserved; used to align the structure to a doubleword boundary. This member should not be used or referenced. Its name and usage can change in future releases.
dmBitsPerPel
Color resolution, in bits per pixel, of the display device (for example, 4 bits for 16 colors, 8 bits for 256 colors, or 16 bits for 65536 colors).
dmPelsWidth
Width, in pixels, of the visible device surface.
dmPelsHeight
Height, in pixels, of the visible device surface.
dmDisplayFlags
Device display-mode flag. Can be one of these values:
Value | Meaning |
DM_GRAYSCALE (0x00000001) | Display is a non-color device. If this value is not specified, color is assumed. |
DM_INTERLACED (0x00000002) | Display mode is interlaced. If the value is not specified, non-interlaced is assumed. |
dmDisplayFrequency
Frequency, in hertz (cycles per second), of the display device in a particular mode.
dmICMMethod
ICM method flag. Determines how ICM is handled. For a non-ICM application, this member determines if ICM is enabled of disabled. For ICM applications, Windows examines this member to determine how to handle ICM support. Can be one of these values:
Value | Meaning |
DMICMMETHOD_SYSTEM (1) | ICM is handled by Windows. |
DMICMMETHOD_NONE (2) | ICM is disabled. |
DMICMMETHOD_DRIVER (3) | ICM is handled by the device driver. |
DMICMMETHOD_DEVICE (4) | ICM is handled by the destination device. |
The printer driver must provide a user interface for setting this member. Most printer drivers support only the DCMICMMETHOD_SYSTEM or DCMICMMETHOD_NONE values. Drivers for PostScript printers support all values.
dmICMIntent
ICM-intent flag. Indicates which of the three possible color matching intents should be used by default. This member is primarily for non-ICM applications. ICM application can establish intent by using the ICM functions. Can be one of these values:
Value | Meaning |
DMICM_SATURATE (1) | Color matching should optimize for color saturation. This is the most appropriate choice for business graphs, when dithering is not desired. |
DMICM_CONTRAST (2) | Color matching should optimize for color contrast. This is the most appropriate choice for scanned or photographic images, when dithering is desired. |
DMICM_COLORMETRIC (3) | Color matching should optimize to match the exact color requested. This is most appropriate for use with business logos or other images when an exact color match is desired. |
dmMediaType
Type of media being printed on. Can be one of the following predefined values, or a driver defined value greater than the value of DMMEDIA_USER.
Value | Meaning |
DMMEDIA_STANDARD (1) | Plain paper |
DMMEDIA_GLOSSY (2) | Glossy paper |
DMMEDIA_TRANSPARENCY (3) | Transparent film |
dmDitherType
Dithering-type flag. Specifies how dithering is to be done.. Can be one of the following predefined values, or a driver defined value greater than the value of DMDITHER_USER.
Value | Meaning |
DMDITHER_NONE (1) | No dithering. |
DMDITHER_COARSE (2) | Dither with a coarse brush.*/ |
DMDITHER_FINE (3) | Dither with a fine brush.*/ |
DMDITHER_LINEART (4) | Line art dithering; a special dither method that produces well-defined borders between black, white, and gray scalings. It is not suitable for images that include continuous graduations in intensity and hue, such as scanned photographs. |
DMDITHER_GRAYSCALE (5) | Device does grayscaling. |
dmReserved1
Not used; must be zero.
dmReserved2
Not used; must be zero.
A device driver's private data follows immediately after the end of the structure. The number of bytes of private data is specified by the dmDriverExtra member.
See also ExtDeviceMode