The property sheet handler uses the AddPages member function in addition to the usual IUnknown member functions. The system calls the AddPages member function when it is about to display a property sheet. The system calls each property sheet handler registered to the file type to allow the handlers to add pages to the property sheets. The following example shows how to implement the AddPages member function.
STDMETHODIMP CSamplePageExt::AddPages(LPFNADDPROPSHEETPAGE lpfnAddPage,
LPARAM lParam)
{
PROPSHEETPAGE psp;
HPROPSHEETPAGE hpage;
psp.dwSize = sizeof(psp); // no extra data
psp.dwFlags = PSP_USEREFPARENT | PSP_USERELEASEFUNC;
psp.hInstance = (HINSTANCE)g_hmodThisDll;
psp.pszTemplate = MAKEINTRESOURCE(DLG_FSPAGE);
psp.pfnDlgProc = FSPage_DlgProc;
psp.pcRefParent = &g_cRefThisDll;
psp.pfnRelease = FSPage_ReleasePage;
psp.lParam = (LPARAM)hdrop;
hpage = CreatePropertySheetPage(&psp);
if (hpage) {
if (!lpfnAddPage(hpage, lParam))
DestroyPropertySheetPage(hpage);
}
return NOERROR;
}