private IntPtr CreatePropertySheetPage() { if (hPropertySheetPage == IntPtr.Zero) { _psp = new PROPSHEETPAGE(); _psp.hInstance = IntPtr.Zero; _psp.dwSize = Marshal.SizeOf(_psp); _psp.dwFlags = pspFlags.PSP_USECALLBACK | pspFlags.PSP_USETITLE | pspFlags.PSP_DLGINDIRECT; _psp.lParam = IntPtr.Zero; if (RightToLeft == RightToLeft.Yes) { _psp.dwFlags |= pspFlags.PSP_RTLREADING; } if (_icon != null) { _psp.dwFlags |= pspFlags.PSP_USEHICON; _psp.hIcon = _icon.GetHicon(); } if (_showHelpButton) { _psp.dwFlags |= pspFlags.PSP_HASHELP; } _psp.pResource = GetDlgTemplate(); _psp.pfnDlgProc = new DialogProc(WndProc); _psp.pfnCallback = new PropSheetPageProc(PropSheetPageCallback); _psp.pszTitle = Text; hPropertySheetPage = Comctl32.CreatePropertySheetPage(ref _psp); if (hPropertySheetPage != IntPtr.Zero) { _extensionReferences.Add(this); } } return(hPropertySheetPage); }
int IShellPropSheetExt.AddPages(IntPtr lpfnAddPage, IntPtr x130fbcecf32fe781) { try { CreatePropertySheetPage(); if (hPropertySheetPage.Equals(0)) { _extensionReferences.Remove(this); return(1); } var func = CFunctionPointer.Create(lpfnAddPage, typeof(bool), typeof(IntPtr), typeof(IntPtr)); if ((bool)func.Invoke(new object[] { hPropertySheetPage, x130fbcecf32fe781 })) { return(0); } _extensionReferences.Remove(this); Comctl32.DestroyPropertySheetPage(hPropertySheetPage); return(1); } catch (Exception exception) { MessageBox.Show(exception.ToString()); return(1); } }