DEVMODE

3.0

#include <print.h>

typedef struct tagDEVMODE {   /* dm */
    char  dmDeviceName[CCHDEVICENAME];
    UINT  dmSpecVersion;
    UINT  dmDriverVersion;
    UINT  dmSize;
    UINT  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;
} DEVMODE;

The DEVMODE structure contains information about a printer driver's initialization and environment data. An application passes this structure to the DeviceCapabilities and ExtDeviceMode functions.

Members

dmDeviceName

Specifies the name of the device the driver supports—for example, “PCL/HP LaserJet” in the case of the Hewlett-Packard LaserJet. Each driver has a unique string.

dmSpecVersion

Specifies the version number of the DEVMODE structure. For Windows version 3.1, this value should be 0x30A.

dmDriverVersion

Specifies the printer driver version number assigned by the printer driver developer.

dmSize

Specifies the size, in bytes, of the DEVMODE structure. (This value does not include the optional dmDriverData member for device-specific data, which can follow the structure.) If an application manipulates only the driver-independent portion of the data, it can use this member to find out the length of the structure without having to account for different versions.

dmDriverExtra

Specifies the size, in bytes, of the optional dmDriverData member for device-specific data, which can follow the structure. If an application does not use device-specific information, it should set this member to zero.

dmFields

Specifies a set of flags that indicate which of the remaining members in the DEVMODE structure have been initialized. It can be any combination (or it can be none) of the following values:

Constant Value

DM_ORIENTATION 0x0000001L
DM_PAPERSIZE 0x0000002L
DM_PAPERLENGTH 0x0000004L
DM_PAPERWIDTH 0x0000008L
DM_SCALE 0x0000010L
DM_COPIES 0x0000100L
DM_DEFAULTSOURCE 0x0000200L
DM_PRINTQUALITY 0x0000400L
DM_COLOR 0x0000800L
DM_DUPLEX 0x0001000L
DM_YRESOLUTION 0x0002000L
DM_TTOPTION 0x0004000L

A printer driver supports only those members that are appropriate for the printer technology.

dmOrientation

Specifies the orientation of the paper. It can be either DMORIENT_PORTRAIT or DMORIENT_LANDSCAPE.

dmPaperSize

Specifies the size of the paper to print on. This member may be set to zero if the length and width of the paper are specified by the dmPaperLength and dmPaperWidth members, respectively. Otherwise, the dmPaperSize member can be set to one of the following predefined values:

Value Meaning

DMPAPER_FIRST DMPAPER_LETTER
DMPAPER_LETTER Letter, 8 1/2 × 11 in.
DMPAPER_LETTERSMALL Letter Small, 8 1/2 × 11 in.
DMPAPER_TABLOID Tabloid, 11 × 17 in.
DMPAPER_LEDGER Ledger, 17 × 11 in.
DMPAPER_LEGAL Legal, 8 1/2 × 14 in.
DMPAPER_STATEMENT Statement, 5 1/2 × 8 1/2 in.
DMPAPER_EXECUTIVE Executive, 7 1/2 × 10 1/2 in.
DMPAPER_A3 A3, 297 × 420 mm
DMPAPER_A4 A4, 210 × 297 mm
DMPAPER_A4SMALL A4 Small, 210 × 297 mm
DMPAPER_A5 A5, 148 × 210 mm
DMPAPER_B4 B4, 250 × 354 mm
DMPAPER_B5 B5, 182 × 257 mm
DMPAPER_FOLIO Folio, 8 1/2 × 13 in.
DMPAPER_QUARTO Quarto, 215 × 275 mm
DMPAPER_10X14 10 × 14 in.
DMPAPER_11X17 11 × 17 in.
DMPAPER_NOTE Note, 8 1/2 × 11 in.
DMPAPER_ENV_9 Envelope #9, 3 7/8 × 8 7/8 in.
DMPAPER_ENV_10 Envelope #10, 4 1/8 × 9 1/2 in.
DMPAPER_ENV_11 Envelope #11, 4 1/2 × 10 3/8 in.
DMPAPER_ENV_12 Envelope #12, 4 1/2 × 11 in.
DMPAPER_ENV_14 Envelope #14, 5 × 11 1/2 in.
DMPAPER_CSHEET C size sheet
DMPAPER_DSHEET D size sheet
DMPAPER_ESHEET E size sheet
DMPAPER_ENV_DL Envelope DL, 110 × 220 mm
DMPAPER_ENV_C3 Envelope C3, 324 × 458 mm
DMPAPER_ENV_C4 Envelope C4, 229 × 324 mm
DMPAPER_ENV_C5 Envelope C5, 162 × 229 mm
DMPAPER_ENV_C6 Envelope C6, 114 × 162 mm
DMPAPER_ENV_C65 Envelope C65, 114 × 229 mm
DMPAPER_ENV_B4 Envelope B4, 250 × 353 mm
DMPAPER_ENV_B5 Envelope B5, 176 × 250 mm
DMPAPER_ENV_B6 Envelope B6, 176 × 125 mm
DMPAPER_ENV_ITALY Envelope, 110 × 230 mm
DMPAPER_ENV_MONARCH Envelope Monarch, 3 7/8 × 7 1/2 in.
DMPAPER_ENV_PERSONAL Envelope, 3 5/8 × 6 1/2 in.
DMPAPER_FANFOLD_US U.S. Standard Fanfold, 14 7/8 × 11 in.
DMPAPER_FANFOLD_STD_GERMAN German Standard Fanfold, 8 1/2 × 12 in.
DMPAPER_FANFOLD_LGL_GERMAN German Legal Fanfold, 8 1/2 × 13 in.
DMPAPER_LAST German Legal Fanfold, 8 1/2 × 13 in.
DMPAPER_USER User-defined

dmPaperLength

Specifies a paper length, in tenths of a millimeter. This parameter overrides the paper length specified by the dmPaperSize member, either for custom paper sizes or for such devices as dot-matrix printers that can print on a variety of page sizes.

dmPaperWidth

Specifies a paper width, in tenths of a millimeter. This parameter overrides the paper width specified by the dmPaperSize member.

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-size paper with a dmScale value of 50 would contain as much data as a page of size 17 by 22 inches because the output text and graphics would be half their original height and width.

dmCopies

Specifies the number of copies printed if the device supports multiple-page copies.

dmDefaultSource

Specifies the default bin from which the paper is fed. The application can override this value by using the GETSETPAPERBINS escape. This member can be one of the following values:

DMBIN_AUTO DMBIN_CASSETTE DMBIN_ENVELOPE DMBIN_ENVMANUAL DMBIN_FIRST DMBIN_LARGECAPACITY DMBIN_LARGEFMT DMBIN_LAST DMBIN_LOWER DMBIN_MANUAL DMBIN_MIDDLE DMBIN_ONLYONE DMBIN_SMALLFMT DMBIN_TRACTOR DMBIN_UPPER

A range of values is reserved for device-specific bins. To be consistent with initialization information, the GETSETPAPERBINS and ENUMPAPERBINS escapes use these values.

dmPrintQuality

Specifies the printer resolution. Following are the 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.

If the printer initializes the dmYResolution member, the dmPrintQuality member specifies the x-resolution of the printer, in dots per inch.

dmColor

Specifies whether a color printer is to render color or monochrome output. Possible values are:

DMCOLOR_COLOR (1) DMCOLOR_MONOCHROME (2)

dmDuplex

Specifies duplex (double-sided) printing for printers capable of duplex printing. This member can be one of the following values:

DMDUP_SIMPLEX (1) DMDUP_HORIZONTAL (2) DMDUP_VERTICAL (3)

dmYResolution

Specifies the y-resolution of the printer, in dots per inch. If the printer initializes this member, the dmPrintQuality member specifies the x-resolution of the printer, in dots per inch.

dmTTOption

Specifies how TrueType fonts should be printed. It can be one of the following values:

Value Meaning

DMTT_BITMAP Print TrueType fonts as graphics. This is the default action for dot-matrix printers.
DMTT_DOWNLOAD Download TrueType fonts as soft fonts. This is the default action for Hewlett-Packard printers that use Printer Control Language (PCL).
DMTT_SUBDEV Substitute device fonts for TrueType fonts. This is the default action for PostScript printers.

Comments

Only drivers that are fully updated for Windows versions 3.0 and later and that export the ExtDeviceMode function use the DEVMODE structure.

An application can retrieve the paper sizes and names supported by a printer by calling the DeviceCapabilities function with the DC_PAPERS, DC_PAPERSIZE, and DC_PAPERNAMES values.

Before setting the value of the dmTTOption member, applications should find out how a printer driver can use TrueType fonts by calling the DeviceCapabilities function with the DC_TRUETYPE value.

Drivers can add device-specific data immediately following the DEVMODE structure.

See Also

DeviceCapabilities, ExtDeviceMode