8/28/2008 This structure contains information about a printer environment and device initialization.
typedef struct_devicemode {
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;
BCHAR dmFormName[CCHFORMNAME];
WORD dmLogPixels;
DWORD dmBitsPerPel;
DWORD dmPelsWidth;
DWORD dmPelsHeight;
DWORD dmDisplayFlags;
DWORD dmDisplayFrequency;
DWORD dmDisplayOrientation;
} DEVMODE;
- dmDeviceName
-
String that specifies the friendly name of the printer.
This string is unique among device drivers.
This name can be truncated to fit in the dmDeviceName array.
- dmSpecVersion
-
Unsupported; set to zero.
- dmDriverVersion
-
Unsupported; set to zero.
- dmSize
-
WORD that specifies the size, in bytes, of the DEVMODE structure, not including any private driver-specific data that can follow the public members of the structure.
Set this member to sizeof(DEVMODE) to indicate the version of the DEVMODE structure being used.
- dmDriverExtra
-
Contains the number of bytes of private driver-data that follow this structure.
If a device driver does not use device-specific information, set this member to zero.
- dmFields
-
DWORD that specifies whether certain members of the DEVMODE structure have been initialized.
If a member is initialized, its corresponding bit is set, otherwise the bit is clear.
A printer driver supports only those member of the DEVMODE structure that are appropriate for the printer technology.
The following table shows the possible values.
| Value | Description |
| DM_ORIENTATION | The dmOrientation member is initialized. |
| DM_PAPERSIZE | The dmPaperSize member is initialized. |
| DM_COPIES | The dmCopies member is initialized. |
| DM_PRINTQUALITY | The dmPrintQuality member is initialized. |
| DM_COLOR | The dmColor member is initialized. |
| DM_BITSPERPEL | The dmBitsPerPel member is initialized. |
| DM_PELSWIDTH | The dmPelsWidth member is initialized. |
| DM_PELSHEIGHT | The dmPelsHeight member is initialized. |
| DM_DISPLAYORIENTATION | The ChangeDisplaySetttingsEx function should set or obtain the current screen orientation in the dmDisplayOrientation member. |
| DM_DISPLAYQUERYORIENTATION | The ChangeDisplaySetttingsEx function should query the display driver to determine whether it supports screen rotation. |
- dmOrientation
-
Short integer that specifies the orientation of the paper for printer devices.
The following table shows the possible values.
| Value | Description |
| DMORIENT_LANDSCAPE | Prints in landscape orientation. |
| DMORIENT_PORTRAIT | Prints in portrait orientation. |
- dmPaperSize
-
Short integer that specifies the size of the paper for printer devices.
This following table shows the possible predefined values.
| Value | Description |
| DMPAPER_A4 | A4 sheet, 210 millimeters by 297 millimeters |
| DMPAPER_B4 | B4 sheet, 250 millimeters by 354 millimeters |
| DMPAPER_B5 | B5 sheet, 182 millimeters by 257 millimeters |
| DMPAPER_LEGAL | Legal, 8 1/2 inches by 14 inches |
| DMPAPER_LETTER | Letter, 8 1/2 inches by 11 inches |
- dmPaperLength
-
Unsupported; set to zero.
- dmPaperWidth
-
Unsupported; set to zero.
- dmScale
-
Unsupported; set to zero.
- dmCopies
-
Short integer that specifies the number of copies that you want to print, if the device supports printing multiple copies.
- dmDefaultSource
-
Unsupported; set to zero.
- dmPrintQuality
-
Short integer that specifies the printer resolution.
The following table shows the possible predefined device-independent values.
| Value | Description |
| DMRES_DRAFT | Draft quality |
| DMRES_HIGH | High quality |
- dmColor
-
Short integer that specifies color or monochrome printing on color printers.
The following table shows the possible values.
| Value | Description |
| DMCOLOR_COLOR | Color printing |
| DMCOLOR_MONOCHROME | Monochrome printing |
- dmDuplex
-
Unsupported; set to zero.
- dmYResolution
-
Unsupported; set to zero.
- dmTTOption
-
Unsupported; set to zero.
- dmCollate
-
Unsupported; set to zero.
- dmFormName
-
Unsupported; set to zero.
- dmLogPixels
-
Unsupported; set to zero.
- dmBitsPerPel
-
DWORD that specifies the 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 65,536 colors.
Display drivers use this member, but printer drivers do not.
- dmPelsWidth
-
DWORD that specifies the width, in pixels, of the visible device surface.
Display drivers use this member, but printer drivers do not.
- dmPelsHeight
-
DWORD that specifies the height, in pixels, of the visible device surface.
Display drivers use this member, but printer drivers do not.
- dmDisplayFlags
-
Unsupported; set to zero.
- dmDisplayFrequency
-
Unsupported; set to zero.
- dmDisplayOrientation
-
DWORD that specifies the orientation of the screen.
The following table shows the possible values.
| Value | Description |
| DMDO_0 | The screen is rotated by 0 degrees. |
| DMDO_90 | The screen is rotated by 90 degrees counterclockwise. |
| DMDO_180 | The screen is rotated by 180 degrees. |
| DMDO_270 | The screen is rotated by 270 degrees counterclockwise. |
The private data for a device driver follows the public portion of the DEVMODE structure.
The size of the public data can vary for different versions of the structure.
The dmSize member specifies the number of bytes of public data.
You should initialize all unsupported members with a value of zero.
| Header | windows.h |
| Windows Embedded CE | Windows CE 2.0 and later |
| Windows Mobile | Windows Mobile Version 5.0 and later |
Reference
ChangeDisplaySettingsEx
CreateDC
GDI Structures