Public Const CCHFORMNAME = 32
Public Const CCHDEVICENAME = 32
Public Const DM_BITSPERPEL = &H40000
Public Const DM_PELSWIDTH = &H80000
Public Const DM_PELSHEIGHT = &H100000Public Const CDS_UPDATEREGISTRY = 1
Public Const CDS_TEST = 2Type DEVMODE
dmDeviceName As String * CCHDEVICENAME
dmSpecVersion As Integer
dmDriverVersion As Integer
dmSize As Integer
dmDriverExtra As Integer
dmFields As Long
dmOrientation As Integer
dmPaperSize As Integer
dmPaperLength As Integer
dmPaperWidth As Integer
dmScale As Integer
dmCopies As Integer
dmDefaultSource As Integer
dmPrintQuality As Integer
dmColor As Integer
dmDuplex As Integer
dmYResolution As Integer
dmTTOption As Integer
dmCollate As Integer
dmFormName As String * CCHFORMNAME
dmUnusedPadding As Integer
dmBitsPerPel As Integer
dmPelsWidth As Long
dmPelsHeight As Long
dmDisplayFlags As Long
dmDisplayFrequency As Long
End Type
Public Const CCHDEVICENAME = 32
Public Const DM_BITSPERPEL = &H40000
Public Const DM_PELSWIDTH = &H80000
Public Const DM_PELSHEIGHT = &H100000Public Const CDS_UPDATEREGISTRY = 1
Public Const CDS_TEST = 2Type DEVMODE
dmDeviceName As String * CCHDEVICENAME
dmSpecVersion As Integer
dmDriverVersion As Integer
dmSize As Integer
dmDriverExtra As Integer
dmFields As Long
dmOrientation As Integer
dmPaperSize As Integer
dmPaperLength As Integer
dmPaperWidth As Integer
dmScale As Integer
dmCopies As Integer
dmDefaultSource As Integer
dmPrintQuality As Integer
dmColor As Integer
dmDuplex As Integer
dmYResolution As Integer
dmTTOption As Integer
dmCollate As Integer
dmFormName As String * CCHFORMNAME
dmUnusedPadding As Integer
dmBitsPerPel As Integer
dmPelsWidth As Long
dmPelsHeight As Long
dmDisplayFlags As Long
dmDisplayFrequency As Long
End Type
The DEVMODE data structure contains information about the device initialization and environment of a printer. typedef struct _devicemode {
BCHAR dmDeviceName[CCHDEVICENAME];
WORD dmSpecVersion;
WORD dmDriverVersion;
WORD dmSize;
WORD dmDriverExtra;
DWORD dmFields;
union {
struct {
short dmOrientation;
short dmPaperSize;
short dmPaperLength;
short dmPaperWidth;
};
POINTL dmPosition;
};
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;
union {
DWORD dmDisplayFlags;
DWORD dmNup;
}
DWORD dmDisplayFrequency;
#if(WINVER >= 0x0400)
DWORD dmICMMethod;
DWORD dmICMIntent;
DWORD dmMediaType;
DWORD dmDitherType;
DWORD dmReserved1;
DWORD dmReserved2;
#if (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400)
DWORD dmPanningWidth;
DWORD dmPanningHeight;
#endif
#endif /* WINVER >= 0x0400 */
} DEVMODE;
Members
dmDeviceName
Specifies the "friendly" name of the printer; for example, "PCL/HP LaserJet" in the case of PCL/HP LaserJet®. This string is unique among device drivers. Note that this name may be truncated to fit in the dmDeviceName array.
dmSpecVersion
Specifies the version number of the initialization data specification on which the structure is based. To ensure the correct version is used for any operating system, use DM_SPECVERSION.
dmDriverVersion
Specifies the printer driver version number assigned by the printer driver developer.
dmSize
Specifies the size, in bytes, of the DEVMODE structure, not including any private driver-specific data that might follow the structure's public members. 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
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 DEVMODE members that are appropriate for the printer technology.
The following values are defined, and are listed here with the corresponding structure members. Value Structure member
DM_ORIENTATION dmOrientation
DM_PAPERSIZE dmPaperSize
DM_PAPERLENGTH dmPaperLength
DM_PAPERWIDTH dmPaperWidth
DM_POSITION dmPosition
DM_SCALE dmScale
DM_COPIES dmCopies
DM_DEFAULTSOURCE dmDefaultSource
DM_PRINTQUALITY dmPrintQuality
DM_COLOR dmColor
DM_DUPLEX dmDuplex
DM_YRESOLUTION dmYResolution
DM_TTOPTION dmTTOption
DM_COLLATE dmCollate
DM_FORMNAME dmFormName
DM_LOGPIXELS dmLogPixels
DM_BITSPERPEL dmBitsPerPel
DM_PELSWIDTH dmPelsWidth
DM_PELSHEIGHT dmPelsHeight
DM_DISPLAYFLAGS dmDisplayFlags
DM_NUP dmNup
DM_DISPLAYFREQUENCY dmDisplayFrequency
DM_ICMMETHOD dmICMMethod
DM_ICMINTENT dmICMIntent
DM_MEDIATYPE dmMediaType
DM_DITHERTYPE dmDitherType
DM_PANNINGWIDTH Windows 2000/XP: dmPanningWidth
DM_PANNINGHEIGHT Windows 2000/XP: dmPanningHeight dmOrientation
For printer devices only, selects the orientation of the paper. This member can be either DMORIENT_PORTRAIT (1) or DMORIENT_LANDSCAPE (2).
For printer devices only, selects the size of the paper to print on. This member can 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 Letter, 8 1/2- by 11-inches
DMPAPER_LEGAL Legal, 8 1/2- by 14-inches
DMPAPER_10X14 10- by 14-inch sheet
DMPAPER_11X17 11- by 17-inch sheet
DMPAPER_12X11 Windows 98/Me, Windows NT 4.0 and later: 12- by 11-inch sheet
DMPAPER_A3 A3 sheet, 297- by 420-millimeters
DMPAPER_A3_ROTATED Windows 98/Me, Windows NT 4.0 and later: A3 rotated sheet, 420- by 297-millimeters
DMPAPER_A4 A4 sheet, 210- by 297-millimeters
DMPAPER_A4_ROTATED Windows 98/Me, Windows NT 4.0 and later: A4 rotated sheet, 297- by 210-millimeters
DMPAPER_A4SMALL A4 small sheet, 210- by 297-millimeters
DMPAPER_A5 A5 sheet, 148- by 210-millimeters
DMPAPER_A5_ROTATED Windows 98/Me, Windows NT 4.0 and later: A5 rotated sheet, 210- by 148-millimeters
DMPAPER_A6 Windows 98/Me, Windows NT 4.0 and later: A6 sheet, 105- by 148-millimeters
DMPAPER_A6_ROTATED Windows 98/Me, Windows NT 4.0 and later: A6 rotated sheet, 148- by 105-millimeters
DMPAPER_B4 B4 sheet, 250- by 354-millimeters
DMPAPER_B4_JIS_ROTATED Windows 98/Me, Windows NT 4.0 and later: B4 (JIS) rotated sheet, 364- by 257-millimeters
DMPAPER_B5 B5 sheet, 182- by 257-millimeter paper
DMPAPER_B5_JIS_ROTATED Windows 98/Me, Windows NT 4.0 and later: B5 (JIS) rotated sheet, 257- by 182-millimeters
DMPAPER_B6_JIS Windows 98/Me, Windows NT 4.0 and later: B6 (JIS) sheet, 128- by 182-millimeters
DMPAPER_B6_JIS_ROTATED Windows 98/Me, Windows NT 4.0 and later: B6 (JIS) rotated sheet, 182- by 128-millimeters
DMPAPER_CSHEET C Sheet, 17- by 22-inches
DMPAPER_DBL_JAPANESE_POSTCARD Windows 98/Me, Windows NT 4.0 and later: Double Japanese Postcard, 200- by 148-millimeters
DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED Windows 98/Me, Windows NT 4.0 and later: Double Japanese Postcard Rotated, 148- by 200-millimeters
DMPAPER_DSHEET D Sheet, 22- by 34-inches
DMPAPER_ENV_9 #9 Envelope, 3 7/8- by 8 7/8-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_C5 C5 Envelope, 162- by 229-millimeters
DMPAPER_ENV_C3 C3 Envelope, 324- by 458-millimeters
DMPAPER_ENV_C4 C4 Envelope, 229- by 324-millimeters
DMPAPER_ENV_C6 C6 Envelope, 114- by 162-millimeters
DMPAPER_ENV_C65 C65 Envelope, 114- by 229-millimeters
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_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_US US Std Fanfold, 14 7/8- by 11-inches
DMPAPER_FANFOLD_STD_GERMAN German Std Fanfold, 8 1/2- by 12-inches
DMPAPER_FANFOLD_LGL_GERMAN German Legal Fanfold, 8 ½- by 13-inches
DMPAPER_FOLIO Folio, 8 1/2- by 13-inch paper
DMPAPER_JAPANESE_POSTCARD_ROTATED Windows 98/Me, Windows NT 4.0 and later: Japanese Postcard Rotated, 148- by 100-millimeters
DMPAPER_JENV_CHOU3 Windows 98/Me, Windows NT 4.0 and later: Japanese Envelope Chou #3
DMPAPER_JENV_CHOU3_ROTATED Windows 98/Me, Windows NT 4.0 and later: Japanese Envelope Chou #3 Rotated
DMPAPER_JENV_CHOU4 Windows 98/Me, Windows NT 4.0 and later: Japanese Envelope Chou #4
DMPAPER_JENV_CHOU4_ROTATED Windows 98/Me, Windows NT 4.0 and later: Japanese Envelope Chou #4 Rotated
DMPAPER_JENV_KAKU2 Windows 98/Me, Windows NT 4.0 and later: Japanese Envelope Kaku #2
DMPAPER_JENV_KAKU2_ROTATED Windows 98/Me, Windows NT 4.0 and later: Japanese Envelope Kaku #2 Rotated
DMPAPER_JENV_KAKU3 Windows 98/Me, Windows NT 4.0 and later: Japanese Envelope Kaku #3
DMPAPER_JENV_KAKU3_ROTATED Windows 98/Me, Windows NT 4.0 and later: Japanese Envelope Kaku #3 Rotated
DMPAPER_JENV_YOU4 Windows 98/Me, Windows NT 4.0 and later: Japanese Envelope You #4
DMPAPER_JENV_YOU4_ROTATED Windows 98/Me, Windows NT 4.0 and later: Japanese Envelope You #4 Rotated
DMPAPER_LAST Windows 2000/XP: DMPAPER_PENV_10_ROTATED
DMPAPER_LEDGER Ledger, 17- by 11-inches
DMPAPER_LETTER_ROTATED Letter Rotated 11 by 8 1/2 11 inches
DMPAPER_LETTERSMALL Letter Small, 8 1/2- by 11-inches
DMPAPER_NOTE Note, 8 1/2- by 11-inches
DMPAPER_P16K Windows 98/Me, Windows NT 4.0 and later: PRC 16K, 146- by 215-millimeters
DMPAPER_P16K_ROTATED Windows 98/Me, Windows NT 4.0 and later: PRC 16K Rotated, 215- by 146-millimeters
DMPAPER_P32K Windows 98/Me, Windows NT 4.0 and later: PRC 32K, 97- by 151-millimeters
DMPAPER_P32K_ROTATED Windows 98/Me, Windows NT 4.0 and later: PRC 32K Rotated, 151- by 97-millimeters
DMPAPER_P32KBIG Windows 98/Me, Windows NT 4.0 and later: PRC 32K(Big) 97- by 151-millimeters
DMPAPER_P32KBIG_ROTATED Windows 98/Me, Windows NT 4.0 and later: PRC 32K(Big) Rotated, 151- by 97-millimeters
DMPAPER_PENV_1 Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #1, 102- by 165-millimeters
DMPAPER_PENV_1_ROTATED Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #1 Rotated, 165- by 102-millimeters
DMPAPER_PENV_2 Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #2, 102- by 176-millimeters
DMPAPER_PENV_2_ROTATED Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #2 Rotated, 176- by 102-millimeters
DMPAPER_PENV_3 Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #3, 125- by 176-millimeters
DMPAPER_PENV_3_ROTATED Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #3 Rotated, 176- by 125-millimeters
DMPAPER_PENV_4 Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #4, 110- by 208-millimeters
DMPAPER_PENV_4_ROTATED Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #4 Rotated, 208- by 110-millimeters
DMPAPER_PENV_5 Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #5, 110- by 220-millimeters
DMPAPER_PENV_5_ROTATED Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #5 Rotated, 220- by 110-millimeters
DMPAPER_PENV_6 Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #6, 120- by 230-millimeters
DMPAPER_PENV_6_ROTATED Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #6 Rotated, 230- by 120-millimeters
DMPAPER_PENV_7 Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #7, 160- by 230-millimeters
DMPAPER_PENV_7_ROTATED Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #7 Rotated, 230- by 160-millimeters
DMPAPER_PENV_8 Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #8, 120- by 309-millimeters
DMPAPER_PENV_8_ROTATED Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #8 Rotated, 309- by 120-millimeters
DMPAPER_PENV_9 Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #9, 229- by 324-millimeters
DMPAPER_PENV_9_ROTATED Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #9 Rotated, 324- by 229-millimeters
DMPAPER_PENV_10 Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #10, 324- by 458-millimeters
DMPAPER_PENV_10_ROTATED Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #10 Rotated, 458- by 324-millimeters
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
For printer devices only, overrides the length of the paper specified by the dmPaperSize member, either for custom paper sizes or for devices such as dot-matrix printers that 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.
dmPaperWidth
For printer devices only, overrides the width of the paper specified by the dmPaperSize member.
dmPosition
Windows 98/Me, Windows 2000/XP: For display devices only, a POINTL structure that indicates the positional coordinates of the display device in reference to the desktop area. The primary display device is always located at coordinates (0,0).
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 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
Selects the number of copies printed if the device supports multiple-page copies.
dmDefaultSource
Specifies the paper source. To retrieve a list of the available paper sources for a printer, use the DeviceCapabilities function with the DC_BINS flag.
This member can be one of the following values, or it can be a device-specific value greater than or equal to DMBIN_USER. DMBIN_ONLYONE
DMBIN_LOWER
DMBIN_MIDDLE
DMBIN_MANUAL
DMBIN_ENVELOPE
DMBIN_ENVMANUAL
DMBIN_AUTO
DMBIN_TRACTOR
DMBIN_SMALLFMT
DMBIN_LARGEFMT
DMBIN_LARGECAPACITY
DMBIN_CASSETTE
DMBIN_FORMSOURCE 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 specified, it specifies the number of dots per inch (DPI) and is therefore device dependent. dmColor
Switches between color and monochrome on color printers. Following are the possible values:
DMCOLOR_COLOR
DMCOLOR_MONOCHROME dmDuplex
Selects duplex or double-sided printing for printers capable of duplex printing. Following are the possible values. Value Meaning
DMDUP_SIMPLEX Normal (nonduplex) printing.
DMDUP_HORIZONTAL Short-edge binding, that is, the long edge of the page is horizontal.
DMDUP_VERTICAL Long-edge binding, that is, the long edge of the page is vertical.
dmYResolution
Specifies the y-resolution, in dots per inch, of the printer. If the printer initializes this member, the dmPrintQuality member specifies the x-resolution, in dots per inch, of the printer.
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 action for dot-matrix printers.
DMTT_DOWNLOAD Downloads TrueType fonts as soft fonts. This is the default action for Hewlett-Packard printers that use Printer Control Language (PCL).
DMTT_DOWNLOAD_OUTLINE Window 95/98/Me, Windows NT 4.0 and later: Downloads TrueType fonts as outline soft fonts.
DMTT_SUBDEV Substitutes device fonts for TrueType fonts. This is the default action for PostScript® printers.
dmUnusedPadding
Used to align the structure to a DWORD boundary. This should not be used or referenced. Its name and usage is reserved, and can change in future releases.
dmCollate
Specifies whether collation should be used when printing multiple copies. (This member is ignored unless the printer driver indicates support for collation by setting the dmFields member to DM_COLLATE.) This member can be one of the following values. Value Meaning
DMCOLLATE_TRUE Collate when printing multiple copies.
DMCOLLATE_FALSE Do not collate when printing multiple copies.
Using DMCOLLATE_TRUE provides faster, more efficient output for collation, since the data is sent to the device driver just once, no matter how many copies are required. The printer is told to simply print the page again. dmFormName
Windows NT/2000/XP: Specifies the name of the form to use; for example, "Letter" or "Legal". A complete set of names can be retrieved by using the EnumForms function.
Windows 95/98/Me: Printer drivers do not use this member. dmLogPixels
Specifies the number of pixels per logical inch. Printer drivers do not use this member.
dmBitsPerPel
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, for example, in the ChangeDisplaySettings function. Printer drivers do not use this member.
dmPelsWidth
Specifies the width, in pixels, of the visible device surface. Display drivers use this member, for example, in the ChangeDisplaySettings function. Printer drivers do not use this member.
dmPelsHeight
Specifies the height, in pixels, of the visible device surface. Display drivers use this member, for example, in the ChangeDisplaySettings function. Printer drivers do not use this member.
dmDisplayFlags
Specifies the device's display mode. This member can be a combination of the following values. Value Meaning
DM_GRAYSCALE Specifies that the display is a noncolor 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.
Display drivers use this member, for example, in the ChangeDisplaySettings function. Printer drivers do not use this member. dmNup
Specifies where the NUP is done. It can be one of the following. Value Meaning
DMNUP_SYSTEM The print spooler does the NUP.
DMNUP_ONEUP The application does the NUP.