INF: Using ExtDeviceMode with DM_COPY

ID Number: Q77551

3.00 3.10

WINDOWS

Summary:

The documentation for the ExtDeviceMode function on page 4-130 of the

"Microsoft Windows Software Development Kit Reference Volume 1" does

not completely explain the results of setting the wMode parameter to

various values, in particular the DM_COPY value. This function may

produce unexpected results if the wMode parameter is set incorrectly.

More Information:

For a complete explanation of the ExtDeviceMode function, see the

"Microsoft Windows Software Development Kit Guide to Programming,"

starting on page 17-6, in particular the paragraph on the bottom of

page 17-7:

IMPORTANT: In order to change the settings, you must specify at

least one input value and one output value.... If you specify only

output values (DM_COPY or DM_UPDATE), the driver provides its

current settings and ignores any input you provide. If you specify

only input values (DM_MODIFY or DM_PROMPT), calling ExtDeviceMode

generates no output, so your input has no real effect.

If the wMode parameter is set to DM_COPY only, the printer's default

settings will be copied into the output buffer -- even if an input

buffer is specified.

In some cases, it is necessary to copy the print settings from the

input buffer to the output buffer (for instance, to validate some

fields in the structure). To do this, set the wMode parameter to

(DM_COPY | DM_MODIFY).

For more information about using the ExtDeviceMode function, query on

the words:

prod (winsdk) and ExtDeviceMode

Note that DM_IN_BUFFER, DM_IN_PROMPT, DM_OUT_BUFFER, and

DM_OUT_DEFAULT are aliases for the DM_MODIFY, DM_PROMPT, DM_COPY, and

DM_UPDATE constants, respectively.

Additional reference words: 3.00 3.10 3.x DeviceMode printing