HPROPSHEETPAGE SH_CreatePropertySheetPage(WORD wDialogId, DLGPROC pfnDlgProc, LPARAM lParam, LPCWSTR pwszTitle) { HRSRC hRes = FindResourceW(shell32_hInstance, MAKEINTRESOURCEW(wDialogId), (LPWSTR)RT_DIALOG); if (hRes == NULL) { ERR("failed to find resource id\n"); return NULL; } LPVOID pTemplate = LoadResource(shell32_hInstance, hRes); if (pTemplate == NULL) { ERR("failed to load resource\n"); return NULL; } PROPSHEETPAGEW Page; memset(&Page, 0x0, sizeof(PROPSHEETPAGEW)); Page.dwSize = sizeof(PROPSHEETPAGEW); Page.dwFlags = PSP_DLGINDIRECT; Page.pResource = (DLGTEMPLATE*)pTemplate; Page.pfnDlgProc = pfnDlgProc; Page.lParam = lParam; Page.pszTitle = pwszTitle; if (pwszTitle) Page.dwFlags |= PSP_USETITLE; return CreatePropertySheetPageW(&Page); }
HPROPSHEETPAGE InitializePropertySheetPage(LPWSTR resname, DLGPROC dlgproc, LPARAM lParam, LPWSTR szTitle) { PROPSHEETPAGEW ppage; memset(&ppage, 0x0, sizeof(PROPSHEETPAGEW)); ppage.dwSize = sizeof(PROPSHEETPAGEW); ppage.dwFlags = PSP_DEFAULT; ppage.u.pszTemplate = resname; ppage.pfnDlgProc = dlgproc; ppage.lParam = lParam; ppage.hInstance = netshell_hInstance; if (szTitle) { ppage.dwFlags |= PSP_USETITLE; ppage.pszTitle = szTitle; } return CreatePropertySheetPageW(&ppage); }
BOOL WINAPI SerialPortPropPageProvider(PSP_PROPSHEETPAGE_REQUEST lpPropSheetPageRequest, LPFNADDPROPSHEETPAGE lpfnAddPropSheetPageProc, LPARAM lParam) { PROPSHEETPAGEW PropSheetPage; HPROPSHEETPAGE hPropSheetPage; FIXME("SerialPortPropPageProvider(%p %p %lx)\n", lpPropSheetPageRequest, lpfnAddPropSheetPageProc, lParam); if (lpPropSheetPageRequest->PageRequested == SPPSR_ENUM_ADV_DEVICE_PROPERTIES) { FIXME("SPPSR_ENUM_ADV_DEVICE_PROPERTIES\n"); PropSheetPage.dwSize = sizeof(PROPSHEETPAGEW); PropSheetPage.dwFlags = 0; PropSheetPage.hInstance = hInstance; PropSheetPage.pszTemplate = MAKEINTRESOURCE(IDD_SERIALSETTINGS); PropSheetPage.pfnDlgProc = SerialSettingsDlgProc; PropSheetPage.lParam = 0; PropSheetPage.pfnCallback = NULL; hPropSheetPage = CreatePropertySheetPageW(&PropSheetPage); if (hPropSheetPage == NULL) { FIXME("CreatePropertySheetPageW() failed!\n"); return FALSE; } if (!(*lpfnAddPropSheetPageProc)(hPropSheetPage, lParam)) { FIXME("lpfnAddPropSheetPageProc() failed!\n"); DestroyPropertySheetPage(hPropSheetPage); return FALSE; } } FIXME("Done!\n"); return TRUE; }
//---------------------------------------------------------------------------- // // Description: // Adds another property page to the handler's properties dialog. // // Parameters: // lpfnAddPage - Pointer to the function which we call to add the page. // lParam - Reserved, must be passed to lpfnAddPage. // // Return Values: // S_OK - Page was successfully added. // Other HRESULTs - Page was not added. // //---------------------------------------------------------------------------- STDMETHODIMP CMyDevicePropertySheet::AddPages( __in LPFNADDPROPSHEETPAGE lpfnAddPage, __in LPARAM lParam) { HRESULT hr = E_FAIL; PROPSHEETPAGEW psp = {0}; HPROPSHEETPAGE hPage = NULL;; // Build the PROPSHEETPAGEW structure which // describes the page we will add psp.dwSize = sizeof(psp); psp.dwFlags = PSP_DEFAULT | PSP_USETITLE; psp.hInstance = g_hmodThisDll; psp.pszTemplate = MAKEINTRESOURCEW(IDD_PROPPAGE); psp.pfnDlgProc = _DlgProc; psp.lParam = (LPARAM) this; psp.pszTitle = MAKEINTRESOURCEW(IDS_PROPS_TITLE); hPage = CreatePropertySheetPageW(&psp); if (hPage != NULL) { // Add the page. If it fails, then destroy the // page we have created. if (!lpfnAddPage(hPage, lParam)) { DestroyPropertySheetPage(hPage); hPage = NULL; } } if (hPage != NULL) { hr = S_OK; } return hr; } //*** CMyDevicePropertySheet::AddPages