}// CreatePropertyPages internal void CreateSinglePropertyPage(IPropertySheetCallback lpProvider, CPropPage ppage) { PROPSHEETPAGE psp = new PROPSHEETPAGE(); IntPtr hPage; // Fill in the property sheet page structure with the appropriate info psp.dwSize = 48; psp.dwFlags = PSP.DEFAULT | PSP.DLGINDIRECT | PSP.USETITLE | PSP.USEHEADERTITLE | PSP.USEHEADERSUBTITLE; psp.hInstance = m_hModule; // We're using just a plain resource file as a "placeholder" for our WFC // placed controls psp.pResource = ppage.GetDialogTemplate(); psp.pszTitle = ppage.Title(); psp.hIcon = ppage.Icon(); psp.pszHeaderTitle = ppage.HeaderTitle(); psp.pszHeaderSubTitle = ppage.HeaderSubTitle(); // See if our property page uses a icon if (psp.hIcon != (IntPtr)(-1)) { psp.dwFlags |= PSP.USEHICON; } // See if our property page uses a title if (ppage.Title() != null) { psp.dwFlags |= PSP.USETITLE; } // See if the property page uses a header title if (psp.pszHeaderTitle != null) { psp.dwFlags |= PSP.USEHEADERTITLE; } // See if the property page uses a header subtitle if (psp.pszHeaderSubTitle != null) { psp.dwFlags |= PSP.USEHEADERSUBTITLE; } psp.pfnDlgProc = ppage.DialogProc; hPage = CreatePropertySheetPage(ref psp); // See if we were able to register the property page if (hPage == (IntPtr)0) { MessageBox("Couldn't create the property page", "", 0); throw new Exception("Unable to RegisterPropertyPage"); } else { // Add the page to the property sheet lpProvider.AddPage(hPage); } }// CreateSinglePropertyPage
internal static extern IntPtr CreatePropertySheetPage(ref PROPSHEETPAGE psp);