DEVMODE

typedef struct _devicemode { /* dvmd */

TCHAR 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;

short dmCollate;

TCHAR dmFormName[32];

} DEVMODE;

The DEVMODE data structure contains information about the device initialization and environment of a printer driver. An application passes this structure to the DeviceCapabilitiesEx and ExtDeviceModeEx functions.

Members

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) 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

Contains the size of the dmDriverData member 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 member to zero.

dmmembers

Is a bitmember that specifies which of the remaining members 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 members that are appropriate for the printer technology.

dmOrientation

Selects the orientation of the paper. It can be either DMORIENT_PORTRAIT (1) or DMORIENT_LANDSCAPE (2).

dmPaperSize

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

Value Meaning

DMPAPER_LETTER 8 1/2 short dm 8 –by-11-inch paper
DMPAPER_LEGAL 8 1/2 short dm 8 –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 3 7/8 short dm 8 –by-8 7/8 short dm 8 –inch #9 envelope
DMPAPER_ENV_10 4 1/8 short dm 8 –by-9 1/5 short dm 8 –inch #10 envelope
DMPAPER_ENV_11 4 1/2 short dm 8 –by-10 3/8 short dm 8 –inch #11 envelope
DMPAPER_ENV_12 4 3/4 short dm 8 –by-11-inch #12 envelope
DMPAPER_ENV_14 5-by-11 1/2 short dm 8 –inch #14 envelope

dmPaperLength

Overrides the length of the paper specified by the dmPaperSize member, 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 member.

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 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

Switches between color and monochrome on color printers. Possible values are:

DMCOLOR_COLOR DMCOLOR_MONOCHROME

dmDuplex

Selects duplex or double-sided printing for printers capable of duplex printing. Values for this field include:

DMDUP_SIMPLEX DMDUP_HORIZONTAL DMDUP_VERTICAL

dmDriverData

Contains device-specific data defined by the device driver.

Comments

Only drivers fully updated for Windows version 3.x and which export the ExtDeviceModeEx function use the DEVMODE structure.

See Also

DeviceCapabilitiesEx, ExtDeviceModeEx