ExtDeviceModePropSheet

int ExtDeviceModePropSheet(HWND hWnd, HINSTANCE hinstDriver, 
    LPCSTR lpszDevice, LPCSTR lpszPort, DWORD dwReserved,
    LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
 

Presents a property sheet to the user for controlling the attributes of a printer.

hWnd Parent window for the dialog box.
hinstDriver Module instance of the device driver.
lpszDevice Points to a null-terminated string that contains the friendly name of the printer.
lpszPort Points to a null-terminated string that contains the name of the port to which the printer is connected, such as LPT1.
dwReserved Unused; set to zero.
lpfnAddPage See the definition of the ExtDeviceMode function. The printer driver enumerates property pages back to the caller using the lpfnAddPage and lParam parameters. The function specified by lpfnAddPage is called by the driver to enumerate each HPROPSHEETPAGE.
lParam See the definition of the ExtDeviceMode function. The value of this parameter is passed back to the function specified by the lpfnAddPage parameter.

In order to support the new property sheet dialog boxes, printer drivers must fully support the new DEVMODE structure as well as this ExtDeviceModePropSheet DDI. For the basic information about property sheet management and manipulation, see the Win32 SDK documentation. The basic property sheet definitions can be found in PRSHT.H in %SDKROOT%\INC16 after the Win32 SDK is installed. The ExtDeviceModePropSheet definitions can be found in PRINT.H in %SDKROOT%\INC16.

When a printer driver receives an ExtDeviceModePropSheet call, it must build each of the property sheet dialogs it provides. The driver calls lpfnAddPage once for each property sheet it provides and should return from the ExtDeviceModePropSheet call only after all the property sheets have been added by calls to lpfnAddPage.

Note that since creating property sheets is an asynchronous process, the driver ExtDeviceModePropSheet function will return before the dialogs are actually created. Therefore, any data that is used to process the dialogs or update the system after the dialogs close must be dynamically allocated and a pointer to the structure passed in the PropSheetPage.lParam field. This data will then be accessible in the WM_INITDIALOG message and should be associated with that window. The simplest way to do this is to use

SetWindowLong(hWnd,DLG_USER,lpMyData)
 

A printer driver must assume that pointers passed to the ExtDeviceModePropSheet function will be invalid until the property sheet pages are actually created, so any data passed as parameters must be stored in the dynamically allocated structure.

The driver should use a release function to correctly terminate the property sheets (see the Win32 SDK documentation for more information about this). Terminating a property sheet also involves updating the default DEVMODE structure, sending a WM_DEVMODECHANGE message, freeing the allocated data structure, etc.