You can use the ExtDeviceMode function to perform one or more actions at a time—for example:
Retrieve a DEVMODE structure containing the driver's current print settings.
Change one or more of the driver's current print settings.
Prompt the user for print settings.
Reset the printer environment and the information in WIN.INI.
Because ExtDeviceMode provides so many different features, you will probably find that your application calls ExtDeviceMode repeatedly during the process of retrieving, altering, and maintaining print settings.
When calling the ExtDeviceMode function, your application should specify the following information:
The module handle of the printer driver (returned by the LoadLibrary or GetModuleHandle function).
The name of the printer model (for example, HP LaserJet Series II).
The name of the port to which the printer is connected (for example, LPT2).
The operation(s) that the device driver is to perform. Your application requests different operations by setting the values that make up the fwMode parameter. To request several operations at once, combine two or more values by using the OR operator.
The input buffer (if any). The application can supply a partial or complete DEVMODE structure as input. (Unlike other functions that use DEVMODE, ExtDeviceMode does not require that the input DEVMODE structure be complete.)
The output buffer (if any). At the application's request, the driver writes a complete DEVMODE structure to the output buffer.
Note:
The ExtDeviceMode function requires eight parameters in all; the list above includes only parameters that are directly relevant to this discussion. For a complete list of parameters for the ExtDeviceMode function, see the Microsoft Windows Programmer's Reference, Volume 2.