Today's tutorial will guide you through the process of creating filter settings page for the Reverse filter we created in last article. The page will be displayed as a part of the regular system dialog after clicking the "Advanced" button for our sample XPS driver and will be very simple as it will contain just one checkbox (for enabling/disabling the reverse function).
The settings, however, will have no effect yet - the filter will be always active. Connecting the settings to the filter will be discussed in some future article.
Unlike the previous article, today's all work will be done only in [sample root]\src\ui directory.
- Open [sample root]\src\ui\xdsmpldlg.rc resource file for edit (in MSVC).
- Right-click the Dialog tree item, choose "Add resource..." and create new dialog. In Properties set this dialog's ID to IDD_REVERSE. Then also make following changes:
- set 3D look to true
- set Border to none
- set Style to Child
- set System menu to false
- set Disabled to true
- Every control class must contain: constructor, virtual destructor, private static string. If the control need some initialisation (e.g. setting default value), the class must also contain an overriden OnInit method.
- Every page class must contain constructor, virtual destructor and overriden method InitDlgBox (which will set the dialog UI template and title).
pPropPage = new CReversePropPage();
if (SUCCEEDED(hr = CHECK_POINTER(pPropPage, E_OUTOFMEMORY)))
This code snippet creates a new instance of our setting page and adds it in the pages vector if successful. When user opens the "Advanced" dialog of our XPS printer (in Windows Control Panel), the system calls DocumentPropertySheets function where the content of this vector is processed (PropPageInit function is then called on every page which invokes the provided InitDlgBox function of each page).