From 19e4cd0699d73b61208160b40f520f2c0ae83689 Mon Sep 17 00:00:00 2001 From: David Hall Date: Sun, 22 Jul 2018 11:44:27 -0600 Subject: [PATCH] Added IShellPropSheetExt and supporting code. --- PInvoke/Shell32/ShObjIdl.IShellPropSheetExt.cs | 74 ++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 PInvoke/Shell32/ShObjIdl.IShellPropSheetExt.cs diff --git a/PInvoke/Shell32/ShObjIdl.IShellPropSheetExt.cs b/PInvoke/Shell32/ShObjIdl.IShellPropSheetExt.cs new file mode 100644 index 00000000..a9be3b7a --- /dev/null +++ b/PInvoke/Shell32/ShObjIdl.IShellPropSheetExt.cs @@ -0,0 +1,74 @@ +using System; +using System.Runtime.InteropServices; + +namespace Vanara.PInvoke +{ + public static partial class Shell32 + { + /// + /// A function that the property sheet handler calls to add a page to the property sheet. The function takes a property sheet handle + /// returned by the CreatePropertySheetPage function and the lParam parameter passed to that method. + /// + /// A property sheet handle returned by the CreatePropertySheetPage function. + /// The lParam parameter passed to the CreatePropertySheetPage function. + /// + [PInvokeData("Shobjidl.h")] + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + public delegate bool LPFNSVADDPROPSHEETPAGE(IntPtr hPropSheetPage, IntPtr lParam); + + /// Used by IShellPropSheetExt::ReplacePage. + [PInvokeData("Shobjidl.h")] + public enum EXPPS + { + /// Undocumented. + EXPPS_FILETYPES = 0x00000001, + } + + /// Exposes methods that allow a property sheet handler to add or replace pages in the property sheet displayed for a file object. + [ComImport, Guid("000214E9-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [PInvokeData("Shobjidl.h")] + public interface IShellPropSheetExt + { + /// + /// Adds one or more pages to a property sheet that the Shell displays for a file object. The Shell calls this method for each + /// property sheet handler registered to the file type. + /// + /// + /// A pointer to a function that the property sheet handler calls to add a page to the property sheet. The function takes a + /// property sheet handle returned by the CreatePropertySheetPage function and the lParam parameter passed to this method. + /// + /// Handler-specific data to pass to the function pointed to by pfnAddPage. + /// + /// If successful, returns a one-based index to specify the page that should be initially displayed. See Remarks for more information. + /// + /// + /// For each page that the property sheet handler needs to add to a property sheet, the handler fills a PROPSHEETPAGE structure, + /// calls the CreatePropertySheetPage function, and then calls the function pointed to by pfnAddPage. + /// + /// You can request through your implementation that a particular property sheet page be displayed first, instead of the default + /// page. To do so, return the one-based index of the desired page relative to the pages you added. For example, if you added + /// three property sheet pages, A, B, and C, and you want B to be the selected page, then the return value should be 2. Note that + /// this return value is only a request. The property sheet might still display the default page. + /// + /// + uint AddPages([In] LPFNSVADDPROPSHEETPAGE pfnAddPage, [In] IntPtr lParam); + + /// Replaces a page in a property sheet for a Control Panel object. + /// + /// Not used. + /// Microsoft Windows XP and earlier: A type EXPPS identifier of the page to replace. + /// + /// + /// A pointer to a function that the property sheet handler calls to replace a page to the property sheet. The function takes a + /// property sheet handle returned by the CreatePropertySheetPage function and the lParam parameter passed to this method. + /// + /// The parameter to pass to the function specified by the pfnReplacePage parameter. + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// To replace a page, a property sheet handler fills a PROPSHEETPAGE structure, calls CreatePropertySheetPage, and then calls + /// the function specified by pfnReplacePage. + /// + HRESULT ReplacePage([In] EXPPS uPageID, [In] LPFNSVADDPROPSHEETPAGE pfnReplaceWith, [In] IntPtr lParam); + } + } +} \ No newline at end of file