Your application can direct the printer driver to display its Print Setup dialog box, from which the user can specify changes to the print settings. The driver changes its current settings to reflect the user's preferences. The driver's output DEVMODE structure (if any) then includes the user's changes.
To make you application prompt the user for print settings, follow these steps:
1.Call ExtDeviceMode, including the following information in the parameters:
Parameter | Value |
lpdmOutput | A pointer to the output buffer |
fwMode | DM_PROMPT | DM_COPY |
The driver then displays its Print Setup dialog box, from which the user can select new print settings.
If the user clicks the OK button after changing the print settings, the ExtDeviceMode function returns the value IDOK and the driver places a DEVMODE structure in the output buffer. This output structure includes the user's changes. If the user clicks the Cancel button instead, the function returns the value IDCANCEL and the driver's output structure will not include any of the user's selections.
2.To set up a printer device context that includes the user's changes, pass the output DEVMODE structure to CreateDC.
Setting the Values in the Print Setup Dialog Box
To preset the values that appear in the driver's Print Setup dialog box, your application can supply a DEVMODE structure with its own settings and direct the driver to display its dialog box. The driver's Print Setup dialog box will appear with the settings you specified in the input DEVMODE structure. The user can then change some or all of the settings. After the user clicks the OK button, the driver provides an output DEVMODE structure that reflects the settings as they appeared when the user clicked OK. The output structure includes settings your application passed as input, with any changes the user made.
To prompt the user with a dialog box that reflects your application's print settings, follow these steps:
1.Set up a partial or complete DEVMODE structure that contains any settings you want to change. For information about setting up a partial DEVMODE structure, see Section 17.4.4, “Tailoring Print Settings for Use with the CreateDC Function.”
2.Call ExtDeviceMode, including the following information in the parameters:
Parameter | Value |
lpdmInput | A pointer to the buffer that contains the partial or complete DEVMODE structure you are supplying |
lpdmOutput | A pointer to the output buffer |
fwMode | DM_MODIFY | DM_PROMPT | DM_COPY |
The driver first changes its current settings to reflect the settings you provided. It then displays its Print Setup dialog box with the new settings; the user can change some or all of the settings in the dialog box.
If the user clicks the OK button after changing the print settings, the ExtDeviceMode function returns the value IDOK and the driver places in the output buffer a DEVMODE structure that includes your changes as updated by the user. If the user clicks the Cancel button instead, the function returns the value IDCANCEL and the driver's output DEVMODE structure includes only the changes your application provided.
3.To set up a printer device context that includes the new settings, pass the output DEVMODE structure to CreateDC.