17.5.1 Specifying ExtDeviceMode Input and Output

By setting the fwMode parameter, you specify how a driver's ExtDeviceMode function will receive input and where it will send output. The driver's response differs depending on the value(s) you use.

If you set fwMode to zero, ExtDeviceMode simply returns the size, in bytes, of the output DEVMODE structure. This is often the first call you will make to ExtDeviceMode, because it lets you know how large to make the output buffer.

You can set fwMode to one or more values other than zero. The following table describes the values for the fwMode parameter and notes whether a value controls input or output.

Value Input/Output Description

DM_MODIFY Input Directs the driver to change its current print settings to match those the application supplied as a DEVMODE structure in the input buffer.
DM_PROMPT Input Directs the driver to display its Print Setup dialog box, then change its current print settings to match those the user specifies.
DM_COPY Output Writes the driver's current print settings to the output buffer in the form of a DEVMODE structure.
DM_UPDATE Output Writes the driver's current print settings to the printer environment and the WIN.INI file.

You can use a combination of fwMode values to let both your application and the user control the print settings.

Important:

To change the settings, you must specify at least one input value and one output value. For example, you could use a combination of the input value DM_PROMPT and the output value DM_UPDATE to tell the driver to take input from the user and write the resulting settings to the current printer environment and WIN.INI. If you specify only an output value (DM_COPY or DM_UPDATE), the driver provides its current settings and ignores any input you provide. If you specify only an input value (DM_PROMPT or DM_MODIFY), calling ExtDeviceMode generates no output, so your input has no real effect.