diff --git a/PInvoke/Shell32/ShObjIdl.IExplorerBrowser.cs b/PInvoke/Shell32/ShObjIdl.IExplorerBrowser.cs index 333537b8..c9c6991c 100644 --- a/PInvoke/Shell32/ShObjIdl.IExplorerBrowser.cs +++ b/PInvoke/Shell32/ShObjIdl.IExplorerBrowser.cs @@ -34,7 +34,7 @@ namespace Vanara.PInvoke /// EBO_NOWRAPPERWINDOW = 0x00000010, - /// Show WebView for sharepoint sites. + /// Show WebView for SharePoint sites. EBO_HTMLSHAREPOINTVIEW = 0x00000020, /// Introduced in Windows Vista. Do not draw a border around the browser window. @@ -66,15 +66,96 @@ namespace Vanara.PInvoke } /// - /// IExplorerBrowser is a browser object that can be either navigated or that can host a view of a data object. As a full-featured - /// browser object, it also supports an automatic travel log. /// - /// The Shell provides a default implementation of IExplorerBrowser as CLSID_ExplorerBrowser.Typically, a developer does not need to - /// provide a custom implementation of this interface. + /// IExplorerBrowser is a browser object that can be either navigated or that can host a view of a data object. As a + /// full-featured browser object, it also supports an automatic travel log. + /// + /// + /// The Shell provides a default implementation of IExplorerBrowser as CLSID_ExplorerBrowser. Typically, a developer does not + /// need to provide a custom implementation of this interface. + /// + /// + /// The Windows Software Development Kit (SDK) provides full samples that demonstrate the use of and interaction with + /// IExplorerBrowser. Download the Explorer Browser Search Sample and the Explorer Browser Custom Contents Sample. /// /// + /// + /// + /// For example code that shows typical use of IExplorerBrowser and its methods, see the Explorer Browser Custom Contents and + /// Explorer Browser Custom Contents samples. + /// + /// + /// After calling this object's Initialize method, its Destroy method must be called to free any windowed resources that were + /// generated in the call to Initialize. + /// + /// + /// The object that hosts the ExplorerBrowser object should derive from IServiceProvider and implement QueryService to respond to any + /// queries for service. For example, the number of panes shown by the browser can be controlled by implementing + /// IExplorerPaneVisibility and responding to any SID_ExplorerPaneVisibility service requests. + /// + /// + /// Frames are disabled by default. To enable frames and get the default set of panes, set the EBO_SHOWFRAMES flag using the + /// IExplorerBrowser::SetOptions method. The default panes, listed as IExplorerPaneVisibility constants, are these: + /// + /// + /// EP_NavPane + /// EP_Commands + /// EP_Commands_Organize + /// EP_Commands_View + /// EP_DetailsPane + /// EP_PreviewPane + /// EP_QueryPane + /// EP_AdvQueryPane + /// EP_StatusBar + /// EP_Ribbon + /// + /// See IExplorerPaneVisibility::GetPaneState for more information. + /// + /// Clients of the ExplorerBrowser object can implement the ICommDlgBrowser, ICommDlgBrowser2, or ICommDlgBrowser3 interfaces and + /// respond to an SID_SExplorerBrowserFrame service request in their QueryService implementations that are called when any + /// ICommDlgBrowser interfaces are called on the browser (usually called from the view as a result of user actions). Note that + /// the client does not receive a call to ICommDlgBrowser::IncludeObject if a folder filter has been set on the browser by a call to IFolderFilterSite::SetFilter. + /// + /// + /// To remain compatible with some older applications, the default Shell view (DefView) performs filtering operations (for example, + /// searching operations executed by a search folder) on the UI thread. For new applications, this is typically not desired; the + /// search should execute on a background thread. To stop the UI thread from filtering and instead run filtering on a background + /// thread, provide ICommDlgBrowser2 through the SID_SExplorerBrowserFrame service request. When ICommDlgBrowser2::GetViewFlags is + /// called, it should return CDB2GVF_NOINCLUDEITEM. For example, if you navigate to a search folder in ExplorerBrowser and you do not + /// return CDB2GVF_NOINCLUDEITEM, the view can stop responding until the entire search is complete. + /// + /// + /// The Shell architecture has three main components: the browser, the views, and the data sources (for example, IShellFolder). The + /// ExplorerBrowser object maintains the current location and navigation to other locations throughout the Shell namespace. It also + /// keeps a travel log (forward and back history). The browser is notified when things happen in the view; for example, when the user + /// double-clicks a folder. In response, the browser navigates to that location. The data sources are the objects that supply the + /// items and folders in the namespace. They also have information about the location, such as the properties of the items and what + /// to add to the context menu when the view requests it. Additionally, the data sources know what view should be created to + /// represent their items at a location. In almost all instances, the folders create the Shell's default view (DefView). Therefore, + /// as the browser navigates, it receives an IShellFolder object for the new location and asks it what view to create. The browser + /// then creates that view and makes it visible, while hiding and then destroying the view that was showing the previous location. + /// The view is responsible for communicating with IShellFolder for the current location and requesting it to enumerate the + /// items, which allows the view to show these items to the user. As the user interacts with the items, the view communicates with + /// the IShellFolder to get any additional information it needs, such as specific properties of the items or the context menu + /// entries for the item. + /// + /// + /// If an application uses the default implementation provided by CLSID_ExplorerBrowser, inserting it into the window of an + /// application and then browsing to a location, ExplorerBrowser creates the proper IShellView as specified by the location that it + /// is browsing to. The application can then ask ExplorerBrowser to give it an interface on the current view, allowing the + /// application to manipulate the view directly if required. The default implementation of the Windows Explorer view object, created + /// by SHCreateShellFolderViewEx, supports the interface IShellView. You may verify that you have the default Shell folder + /// view object by calling IExplorerBrowser::GetCurrentView and then calling QueryInterface on the object returned using the + /// interface ID IID_CDefView. + /// + /// + /// Windows 7 and later. CExplorerBrowser can support in-place navigation by using IServiceProvider::QueryService with the + /// Service ID SID_SlnPlaceBrowser. When using SID_SInPlaceBrowser, the CExplorerBrowser state cannot be set to EBO_NAVIGATEONCE. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nn-shobjidl_core-iexplorerbrowser + [PInvokeData("shobjidl_core.h", MSDNShortId = "da2cf5d4-5a68-4d18-807b-b9d4e2712c10")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("dfd3b6b5-c10c-4be9-85f6-a66969f402f6"), CoClass(typeof(ExplorerBrowser))] - [PInvokeData("Shobjidl.h", MSDNShortId = "da2cf5d4-5a68-4d18-807b-b9d4e2712c10")] public interface IExplorerBrowser { /// Prepares the browser to be navigated. diff --git a/PInvoke/Shell32/ShObjIdl.IExplorerPaneVisibility.cs b/PInvoke/Shell32/ShObjIdl.IExplorerPaneVisibility.cs index d1cce13e..497e1ca7 100644 --- a/PInvoke/Shell32/ShObjIdl.IExplorerPaneVisibility.cs +++ b/PInvoke/Shell32/ShObjIdl.IExplorerPaneVisibility.cs @@ -52,14 +52,56 @@ namespace Vanara.PInvoke [PInvokeData("Shobjidl.h", MSDNShortId = "b940adc2-dfef-49c5-b86c-d0da83db0aad")] public interface IExplorerPaneVisibility { - /// Gets the visibility state of the given Windows Explorer pane. + /// + /// Gets the visibility state of the given Windows Explorer pane. + /// /// - /// A reference to a GUID that uniquely identifies a Windows Explorer pane. One of the constants as defined in Shlguid.h. + /// Type: REFEXPLORERPANE + /// + /// A reference to a GUID that uniquely identifies a Windows Explorer pane. One of the following constants as defined in Shlguid.h. + /// + /// EP_NavPane (cb316b22-25f7-42b8-8a09-540d23a43c2f) + /// The pane on the left side of the Windows Explorer window that hosts the folders tree and Favorites. + /// EP_Commands (d9745868-ca5f-4a76-91cd-f5a129fbb076) + /// Commands module along the top of the Windows Explorer window. + /// EP_Commands_Organize (72e81700-e3ec-4660-bf24-3c3b7b648806) + /// Organize menu within the commands module. + /// EP_Commands_View (21f7c32d-eeaa-439b-bb51-37b96fd6a943) + /// View menu within the commands module. + /// EP_DetailsPane (43abf98b-89b8-472d-b9ce-e69b8229f019) + /// Pane showing metadata along the bottom of the Windows Explorer window. + /// EP_PreviewPane (893c63d1-45c8-4d17-be19-223be71be365) + /// Pane on the right of the Windows Explorer window that shows a large reading preview of the file. + /// EP_QueryPane (65bcde4f-4f07-4f27-83a7-1afca4df7ddd) + /// Quick filter buttons to aid in a search. + /// EP_AdvQueryPane (b4e9db8b-34ba-4c39-b5cc-16a1bd2c411c) + /// Additional fields and options to aid in a search. + /// EP_StatusBar (65fe56ce-5cfe-4bc4-ad8a-7ae3fe7e8f7c) + /// Introduced in Windows 8: A status bar that indicates the progress of some process, such as copying or downloading. + /// EP_Ribbon (d27524a8-c9f2-4834-a106-df8889fd4f37) + /// + /// Introduced in Windows 8: The ribbon, which is the control that replaced menus and toolbars at the top of many + /// Microsoft applications. + /// + /// + /// + /// Type: EXPLORERPANESTATE* + /// + /// When this method returns, contains the visibility state of the given Windows Explorer pane as one of the EXPLORERPANESTATE constants. + /// /// /// - /// When this method returns, contains the visibility state of the given Windows Explorer pane as one of the EXPLORERPANESTATE constants. + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// - EXPLORERPANESTATE GetPaneState([In, MarshalAs(UnmanagedType.LPStruct)] Guid ep); + /// + /// If the implementer does not care about the state of a given pane and therefore does not want to change it, then the + /// implementer should return a success code for the method and EPS_DONTCARE for the parameter. If the method fails, it is + /// treated as if EPS_DONTCARE was returned for the parameter. + /// + [PInvokeData("shobjidl_core.h", MSDNShortId = "6c051cdc-b7f9-48dc-ba32-38f0f1ee5fda")] + [PreserveSig] + HRESULT GetPaneState([In, MarshalAs(UnmanagedType.LPStruct)] Guid ep, ref EXPLORERPANESTATE peps); } /// Constant GUIDs used by IExplorerPaneVisibility::GetPaneState. diff --git a/PInvoke/Shell32/ShObjIdl.IInitializeWithFile.cs b/PInvoke/Shell32/ShObjIdl.IInitializeWithFile.cs index 1dc15af1..f781538e 100644 --- a/PInvoke/Shell32/ShObjIdl.IInitializeWithFile.cs +++ b/PInvoke/Shell32/ShObjIdl.IInitializeWithFile.cs @@ -5,16 +5,51 @@ namespace Vanara.PInvoke { public static partial class Shell32 { - /// Exposes a method to initialize a handler, such as a property handler, thumbnail handler, or preview handler, with a file path. + /// + /// Exposes a method to initialize a handler, such as a property handler, thumbnail handler, or preview handler, with a file path. + /// + /// + /// Whenever possible, it is recommended that initialization be done through a stream using IInitializeWithStream. Benefits of this + /// include increased security and stability. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nn-propsys-iinitializewithfile + [PInvokeData("propsys.h", MSDNShortId = "323181ab-1dc2-4b2a-a91f-3eccd7968bcd")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("b7d14566-0509-4cce-a71f-0a554233bd9b")] public interface IInitializeWithFile { /// - /// Initializes a handler with a file path. + /// Initializes a handler with a file path. /// - /// A pointer to a buffer that contains the file path as a null-terminated Unicode string. - /// One of the following STGM values that indicates the access mode for pszFilePath. - void Initialize([In, MarshalAs(UnmanagedType.LPWStr)] string pszFilePath, STGM grfMode); + /// + /// Type: LPCWSTR + /// A pointer to a buffer that contains the file path as a null-terminated Unicode string. + /// + /// + /// Type: DWORD + /// One of the following STGM values that indicates the access mode for . + /// STGM_READ + /// The file indicated by IInitializeWithFile::Initialize is read-only. + /// STGM_READWRITE + /// The file indicated by IInitializeWithFile::Initialize can be read from and written to. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// Initialize is preferred to this method because of its ability to use files that are not accessible through a Win32 path, such + /// as the contents of a compressed file with a .zip file name extension. Use IInitializeWithFile::Initialize only when + /// the API used by the handler to access the file accepts file paths only. + /// + /// The file pointed to by must remain open for the lifetime of the handler or until IPropertyStore::Commit is called. + /// If the file cannot be opened according to the method's parameter values, this method returns a suitable error code. + /// + /// A handler instance should be initialized only once in its lifetime. Attempts by the calling application to reinitialize the + /// handler should result in the error . + /// + /// + HRESULT Initialize([In, MarshalAs(UnmanagedType.LPWStr)] string pszFilePath, STGM grfMode); } } } \ No newline at end of file diff --git a/PInvoke/Shell32/ShObjIdl.IInitializeWithItem.cs b/PInvoke/Shell32/ShObjIdl.IInitializeWithItem.cs index ad397faa..769dd493 100644 --- a/PInvoke/Shell32/ShObjIdl.IInitializeWithItem.cs +++ b/PInvoke/Shell32/ShObjIdl.IInitializeWithItem.cs @@ -5,14 +5,29 @@ namespace Vanara.PInvoke { public static partial class Shell32 { - /// Exposes a method used to initialize a handler, such as a property handler, thumbnail handler, or preview handler, with an IShellItem. + /// + /// Exposes a method used to initialize a handler, such as a property handler, thumbnail handler, or preview handler, with an IShellItem. + /// + // https://msdn.microsoft.com/en-us/library/windows/desktop/bb761814(v=vs.85).aspx + [PInvokeData("Shobjidl.h", MSDNShortId = "bb761814")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("7f73be3f-fb79-493c-a6c7-7ee14e245841")] public interface IInitializeWithItem { - /// Initializes a handler with an IShellItem. - /// A pointer to an IShellItem. - /// One of the following STGM values that indicate the access mode for psi.. - void Initialize(IShellItem psi, STGM grfMode); + /// Initializes a handler with an IShellItem. + /// + /// Type: IShellItem* + /// A pointer to an IShellItem. + /// + /// + /// Type: DWORD + /// One of the following STGM values that indicate the access mode for psi. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + [PreserveSig] + HRESULT Initialize(IShellItem psi, STGM grfMode); } } } \ No newline at end of file diff --git a/PInvoke/Shell32/ShObjIdl.IInitializeWithStream.cs b/PInvoke/Shell32/ShObjIdl.IInitializeWithStream.cs index 937ce47e..9ac858e2 100644 --- a/PInvoke/Shell32/ShObjIdl.IInitializeWithStream.cs +++ b/PInvoke/Shell32/ShObjIdl.IInitializeWithStream.cs @@ -6,14 +6,52 @@ namespace Vanara.PInvoke { public static partial class Shell32 { - /// Exposes a method that initializes a handler, such as a property handler, thumbnail handler, or preview handler, with a stream. + /// + /// Exposes a method that initializes a handler, such as a property handler, thumbnail handler, or preview handler, with a stream. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nn-propsys-iinitializewithstream + [PInvokeData("propsys.h", MSDNShortId = "9050845d-1e70-4e85-8d2f-c8bbb382abe5")] [ComImport, Guid("b824b49d-22ac-4161-ac8a-9916e8fa3f7f"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IInitializeWithStream { - /// Initializes a handler with a stream. - /// A pointer to an IStream interface that represents the stream source. - /// One of the following STGM values that indicates the access mode for pstream. - void Initialize([In] IStream pstream, STGM grfMode); + /// + /// Initializes a handler with a stream. + /// + /// + /// Type: IStream* + /// A pointer to an IStream interface that represents the stream source. + /// + /// + /// Type: DWORD + /// One of the following STGM values that indicates the access mode for . + /// STGM_READ + /// The stream indicated by is read-only. + /// STGM_READWRITE + /// The stream indicated by is read/write accessible. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// + /// + /// This method is preferred to Initialize due to its ability to use streams that are not accessible through a Win32 path, such + /// as the contents of a compressed file with a .zip file name extension. + /// + /// The stream pointed to by must remain open for the lifetime of the handler or until IPropertyStore::Commit is called. + /// + /// When first opened, the source stream reference points to the beginning of the stream. The handler can seek and read from the + /// stream at any time. A handler can be implemented to read all properties from the stream during Initialize or it can + /// wait until the calling process attempts to enumerate or read properties before fetching them from the stream. + /// + /// + /// A handler instance should be initialized only once in its lifetime. Attempts by the caller to reinitialize the handler should + /// result in the error . + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-iinitializewithstream-initialize + [PreserveSig] + HRESULT Initialize([In] IStream pstream, STGM grfMode); } } } \ No newline at end of file diff --git a/PInvoke/Shell32/ShObjIdl.IInputObject.cs b/PInvoke/Shell32/ShObjIdl.IInputObject.cs index 11e13287..ec37683b 100644 --- a/PInvoke/Shell32/ShObjIdl.IInputObject.cs +++ b/PInvoke/Shell32/ShObjIdl.IInputObject.cs @@ -82,7 +82,9 @@ namespace Vanara.PInvoke /// Indicates if the object has gained or lost the focus. If this value is nonzero, the object has gained the focus. If this /// value is zero, the object has lost the focus. /// - void OnFocusChangeIS([In, MarshalAs(UnmanagedType.IUnknown)] object punkObj, [In, MarshalAs(UnmanagedType.Bool)] bool fSetFocus); + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + [PreserveSig] + HRESULT OnFocusChangeIS([In, MarshalAs(UnmanagedType.IUnknown)] object punkObj, [In, MarshalAs(UnmanagedType.Bool)] bool fSetFocus); } } } \ No newline at end of file diff --git a/PInvoke/Shell32/ShObjIdl.IPreviewHandler.cs b/PInvoke/Shell32/ShObjIdl.IPreviewHandler.cs index 2ddc88a7..6a5046e8 100644 --- a/PInvoke/Shell32/ShObjIdl.IPreviewHandler.cs +++ b/PInvoke/Shell32/ShObjIdl.IPreviewHandler.cs @@ -6,8 +6,9 @@ namespace Vanara.PInvoke public static partial class Shell32 { /// Exposes methods for the display of rich previews. + // https://msdn.microsoft.com/en-us/library/windows/desktop/bb775315(v=vs.85).aspx + [PInvokeData("Shobjidl.h", MSDNShortId = "bb775315")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("8895b1c6-b41f-4c1c-a562-0d564250836f")] - [PInvokeData("Shobjidl.h")] public interface IPreviewHandler { /// @@ -15,33 +16,45 @@ namespace Vanara.PInvoke /// /// A handle to the parent window. /// A pointer to a RECT defining the area for the previewer. - void SetWindow([In] HandleRef hwnd, [In, MarshalAs(UnmanagedType.LPStruct)] RECT prc); + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + [PreserveSig] + HRESULT SetWindow([In] HandleRef hwnd, [In, MarshalAs(UnmanagedType.LPStruct)] RECT prc); /// Directs the preview handler to change the area within the parent hwnd that it draws into. /// A pointer to a RECT to be used for the preview. - void SetRect([In, MarshalAs(UnmanagedType.LPStruct)] RECT prc); + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + [PreserveSig] + HRESULT SetRect([In, MarshalAs(UnmanagedType.LPStruct)] RECT prc); /// /// Directs the preview handler to load data from the source specified in an earlier Initialize method call, and to begin /// rendering to the previewer window. /// - void DoPreview(); + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + [PreserveSig] + HRESULT DoPreview(); /// /// Directs the preview handler to cease rendering a preview and to release all resources that have been allocated based on the /// item passed in during the initialization. /// - void Unload(); + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + [PreserveSig] + HRESULT Unload(); /// Directs the preview handler to set focus to itself. - void SetFocus(); + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + [PreserveSig] + HRESULT SetFocus(); - /// Directs the preview handler to return the HWND from calling the GetFocus Function. - /// - /// When this method returns, contains a pointer to the HWND returned from calling the GetFocus Function from the preview - /// handler's foreground thread. - /// - IntPtr QueryFocus(); + /// + /// Directs the preview handler to return the HWND from calling the GetFocus Function. + /// + /// When this method returns, contains a pointer to the HWND returned from calling the GetFocus Function from the preview + /// handler's foreground thread. + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + [PreserveSig] + HRESULT QueryFocus(out IntPtr phwnd); /// /// Directs the preview handler to handle a keystroke passed up from the message pump of the process in which the preview handler @@ -60,13 +73,16 @@ namespace Vanara.PInvoke /// Enables preview handlers to pass keyboard shortcuts to the host. This interface retrieves a list of keyboard shortcuts and /// directs the host to handle a keyboard shortcut. /// + // https://msdn.microsoft.com/en-us/library/windows/desktop/bb775309(v=vs.85).aspx + [PInvokeData("Shobjidl.h", MSDNShortId = "bb775309")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("fec87aaf-35f9-447a-adb7-20234491401a")] - [PInvokeData("Shobjidl.h")] public interface IPreviewHandlerFrame { /// Gets a list of the keyboard shortcuts for the preview host. - /// A pointer to a PREVIEWHANDLERFRAMEINFO structure that receives accelerator table information. - PREVIEWHANDLERFRAMEINFO GetWindowContext(); + /// A pointer to a PREVIEWHANDLERFRAMEINFO structure that receives accelerator table information. + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + [PreserveSig] + HRESULT GetWindowContext(out PREVIEWHANDLERFRAMEINFO pinfo); /// Directs the host to handle an keyboard shortcut passed from the preview handler. /// A pointer to a WM_COMMAND or WM_SYSCOMMAND window message that corresponds to a keyboard shortcut. @@ -79,21 +95,28 @@ namespace Vanara.PInvoke } /// Exposes methods for applying color and font information to preview handlers. + // https://msdn.microsoft.com/en-us/library/windows/desktop/bb775299(v=vs.85).aspx + [PInvokeData("Shobjidl.h", MSDNShortId = "bb775299")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("196bf9a5-b346-4ef0-aa1e-5dcdb76768b1")] - [PInvokeData("Shobjidl.h")] public interface IPreviewHandlerVisuals { /// Sets the background color of the preview handler. /// A value of type COLORREF to use for the preview handler background. - void SetBackgroundColor(COLORREF color); + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + [PreserveSig] + HRESULT SetBackgroundColor(COLORREF color); /// Sets the font attributes to be used for text within the preview handler. /// A pointer to a LOGFONTW Structure containing the necessary attributes for the font to use. - void SetFont([In, MarshalAs(UnmanagedType.LPStruct)] LOGFONT plf); + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + [PreserveSig] + HRESULT SetFont([In, MarshalAs(UnmanagedType.LPStruct)] LOGFONT plf); /// Sets the color of the text within the preview handler. /// A value of type COLORREF to use for the preview handler text color. - void SetTextColor(COLORREF color); + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + [PreserveSig] + HRESULT SetTextColor(COLORREF color); } /// Accelerator table structure. Used by IPreviewHandlerFrame::GetWindowContext. diff --git a/PInvoke/Shell32/ShObjIdl.IServiceProvider.cs b/PInvoke/Shell32/ShObjIdl.IServiceProvider.cs index 67d2d7f4..03336491 100644 --- a/PInvoke/Shell32/ShObjIdl.IServiceProvider.cs +++ b/PInvoke/Shell32/ShObjIdl.IServiceProvider.cs @@ -10,12 +10,15 @@ namespace Vanara.PInvoke [PInvokeData("servprov.h")] public interface IServiceProvider { - /// Performs as a factory for services that are exposed through an implementation of IServiceProvider. + /// + /// Performs as a factory for services that are exposed through an implementation of IServiceProvider. + /// /// A unique identifier of the requested service. /// A unique identifier of the interface which the caller wishes to receive for the service. - /// The interface specified by the riid parameter. - [return: MarshalAs(UnmanagedType.IUnknown)] - object QueryService([In, MarshalAs(UnmanagedType.LPStruct)] Guid guidService, [In, MarshalAs(UnmanagedType.LPStruct)] Guid riid); - }; + /// The interface specified by the parameter. + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + [PreserveSig] + HRESULT QueryService([In, MarshalAs(UnmanagedType.LPStruct)] Guid guidService, [In, MarshalAs(UnmanagedType.LPStruct)] Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObject); + } } } \ No newline at end of file diff --git a/PInvoke/Shell32/ShObjIdl.IShellExtInit.cs b/PInvoke/Shell32/ShObjIdl.IShellExtInit.cs index 0f92acba..bec88547 100644 --- a/PInvoke/Shell32/ShObjIdl.IShellExtInit.cs +++ b/PInvoke/Shell32/ShObjIdl.IShellExtInit.cs @@ -7,21 +7,27 @@ namespace Vanara.PInvoke public static partial class Shell32 { /// - /// Exposes a method that initializes Shell extensions for property sheets, shortcut menus, and drag-and-drop handlers (extensions that add items to - /// shortcut menus during nondefault drag-and-drop operations). + /// Exposes a method that initializes Shell extensions for property sheets, shortcut menus, and drag-and-drop handlers (extensions + /// that add items to shortcut menus during nondefault drag-and-drop operations). /// + // https://msdn.microsoft.com/en-us/library/windows/desktop/bb775096(v=vs.85).aspx + [PInvokeData("Shobjidl.h", MSDNShortId = "bb775096")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("000214E8-0000-0000-c000-000000000046")] public interface IShellExtInit { /// Initializes a property sheet extension, shortcut menu extension, or drag-and-drop handler. /// - /// A pointer to an ITEMIDLIST structure that uniquely identifies a folder. For property sheet extensions, this parameter is NULL. For shortcut menu - /// extensions, it is the item identifier list for the folder that contains the item whose shortcut menu is being displayed. For nondefault - /// drag-and-drop menu extensions, this parameter specifies the target folder. + /// A pointer to an ITEMIDLIST structure that uniquely identifies a folder. For property sheet extensions, this parameter is + /// NULL. For shortcut menu extensions, it is the item identifier list for the folder that contains the item whose shortcut menu + /// is being displayed. For nondefault drag-and-drop menu extensions, this parameter specifies the target folder. + /// + /// + /// A pointer to an IDataObject interface object that can be used to retrieve the objects being acted upon. /// - /// A pointer to an IDataObject interface object that can be used to retrieve the objects being acted upon. /// The registry key for the file object or folder type. - void Initialize(PIDL pidlFolder, [In] IDataObject pdtobj, uint hkeyProgId); + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + [PreserveSig] + HRESULT Initialize(PIDL pidlFolder, [In] IDataObject pdtobj, IntPtr hkeyProgId); } } } \ No newline at end of file diff --git a/PInvoke/Shell32/ShObjIdl.IShellPropSheetExt.cs b/PInvoke/Shell32/ShObjIdl.IShellPropSheetExt.cs index a9be3b7a..2458566a 100644 --- a/PInvoke/Shell32/ShObjIdl.IShellPropSheetExt.cs +++ b/PInvoke/Shell32/ShObjIdl.IShellPropSheetExt.cs @@ -25,8 +25,9 @@ namespace Vanara.PInvoke } /// Exposes methods that allow a property sheet handler to add or replace pages in the property sheet displayed for a file object. + // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nn-shobjidl_core-ishellpropsheetext + [PInvokeData("shobjidl_core.h", MSDNShortId = "1671ad3e-c131-4de0-a213-b22c9966bae2")] [ComImport, Guid("000214E9-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [PInvokeData("Shobjidl.h")] public interface IShellPropSheetExt { /// diff --git a/PInvoke/Shell32/ShObjIdl.IShellView.cs b/PInvoke/Shell32/ShObjIdl.IShellView.cs index bd255724..bcf8c179 100644 --- a/PInvoke/Shell32/ShObjIdl.IShellView.cs +++ b/PInvoke/Shell32/ShObjIdl.IShellView.cs @@ -2,6 +2,7 @@ using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; using Vanara.Extensions; +using static Vanara.PInvoke.ComCtl32; using static Vanara.PInvoke.Ole32; // ReSharper disable MemberCanBePrivate.Global @@ -16,164 +17,250 @@ namespace Vanara.PInvoke { public static partial class Shell32 { - /// Specifies an application-defined callback function that a property sheet extension uses to add a page to a property sheet. - /// Handle to a property sheet page. - /// Application-defined 32-bit value. - /// Returns TRUE if successful, or FALSE otherwise. - [PInvokeData("Prsht.h")] - [UnmanagedFunctionPointer(CallingConvention.Winapi, SetLastError = true, CharSet = CharSet.Unicode)] - [System.Security.SuppressUnmanagedCodeSecurity] - [return: MarshalAs(UnmanagedType.Bool)] - public delegate bool AddPropSheetPageProc(IntPtr hpage, IntPtr lParam); - /// Flags specifying where the toolbar buttons should go. + [PInvokeData("shobjidl.h")] [Flags] public enum FCT : uint { - /// Merge the toolbar items instead of replacing all of the buttons with those provided by the view. This is the recommended choice. + /// + /// Merge the toolbar items instead of replacing all of the buttons with those provided by the view. This is the recommended choice. + /// FCT_MERGE = 0x0001, + /// Not implemented. FCT_CONFIGABLE = 0x0002, + /// Add at the right side of the toolbar. FCT_ADDTOEND = 0x0004, } /// - /// A value that indicates the frame control to show or hide. One of the following values as defined in Shobjidl.h or -1 for fullscreen/kiosk mode. + /// A value that indicates the frame control to show or hide. One of the following values as defined in Shobjidl.h or -1 for + /// fullscreen/kiosk mode. /// + [PInvokeData("shobjidl.h")] [Flags] public enum FCW : uint { /// The browser's media bar. FCW_INTERNETBAR = 0x0006, + /// The browser's progress bar. FCW_PROGRESS = 0x0008, + /// The browser's status bar. FCW_STATUS = 0x0001, + /// The browser's toolbar. FCW_TOOLBAR = 0x0002, + /// The browser's tree view. FCW_TREE = 0x0003, } /// Folder view flags. + [PInvokeData("shobjidl.h")] [Flags] public enum FOLDERFLAGS : uint { /// Windows 7 and later. No special view options. FWF_NONE = 0x00000000, - /// Automatically arrange the elements in the view. This implies LVS_AUTOARRANGE if the list-view control is used to implement the view. + + /// + /// Automatically arrange the elements in the view. This implies LVS_AUTOARRANGE if the list-view control is used to implement + /// the view. + /// FWF_AUTOARRANGE = 0x00000001, + /// Not supported. FWF_ABBREVIATEDNAMES = 0x00000002, + /// Not supported. FWF_SNAPTOGRID = 0x00000004, + /// Not supported. FWF_OWNERDATA = 0x00000008, + /// Not supported. FWF_BESTFITWINDOW = 0x00000010, - /// Make the folder behave like the desktop. This value applies only to the desktop and is not used for typical Shell folders. This flag implies FWF_NOCLIENTEDGE and FWF_NOSCROLL. + + /// + /// Make the folder behave like the desktop. This value applies only to the desktop and is not used for typical Shell folders. + /// This flag implies FWF_NOCLIENTEDGE and FWF_NOSCROLL. + /// FWF_DESKTOP = 0x00000020, + /// Do not allow more than a single item to be selected. This is used in the common dialog boxes. FWF_SINGLESEL = 0x00000040, + /// Do not show subfolders. FWF_NOSUBFOLDERS = 0x00000080, + /// Draw transparently. This is used only for the desktop. FWF_TRANSPARENT = 0x00000100, + /// Not supported. FWF_NOCLIENTEDGE = 0x00000200, + /// Do not add scroll bars. This is used only for the desktop. FWF_NOSCROLL = 0x00000400, - /// The view should be left-aligned. This implies LVS_ALIGNLEFT if the list-view control is used to implement the view. + + /// + /// The view should be left-aligned. This implies LVS_ALIGNLEFT if the list-view control is used to implement the view. + /// FWF_ALIGNLEFT = 0x00000800, + /// The view should not display icons. FWF_NOICONS = 0x00001000, + /// This flag is deprecated as of Windows XP and has no effect. Always show the selection. FWF_SHOWSELALWAYS = 0x00002000, + /// Not supported. FWF_NOVISIBLE = 0x00004000, + /// Not supported. FWF_SINGLECLICKACTIVATE = 0x00008000, + /// The view should not be shown as a web view. FWF_NOWEBVIEW = 0x00010000, + /// The view should not display file names. FWF_HIDEFILENAMES = 0x00020000, + /// Turns on the check mode for the view. FWF_CHECKSELECT = 0x00040000, - /// Windows Vista and later. Do not re-enumerate the view (or drop the current contents of the view) when the view is refreshed. + + /// + /// Windows Vista and later. Do not re-enumerate the view (or drop the current contents of the view) when the view is refreshed. + /// FWF_NOENUMREFRESH = 0x00080000, + /// Windows Vista and later. Do not allow grouping in the view FWF_NOGROUPING = 0x00100000, + /// Windows Vista and later. When an item is selected, the item and all its sub-items are highlighted. FWF_FULLROWSELECT = 0x00200000, + /// Windows Vista and later. Do not display filters in the view. FWF_NOFILTERS = 0x00400000, + /// Windows Vista and later. Do not display a column header in the view in any view mode. FWF_NOCOLUMNHEADER = 0x00800000, + /// Windows Vista and later. Only show the column header in details view mode. FWF_NOHEADERINALLVIEWS = 0x01000000, - /// Windows Vista and later. When the view is in "tile view mode" the layout of a single item should be extended to the width of the view. + + /// + /// Windows Vista and later. When the view is in "tile view mode" the layout of a single item should be extended to the width of + /// the view. + /// FWF_EXTENDEDTILES = 0x02000000, + /// Windows Vista and later. Not supported. FWF_TRICHECKSELECT = 0x04000000, + /// Windows Vista and later. Items can be selected using checkboxes. FWF_AUTOCHECKSELECT = 0x08000000, + /// Windows Vista and later. The view should not save view state in the browser. FWF_NOBROWSERVIEWSTATE = 0x10000000, + /// Windows Vista and later. The view should list the number of items displayed in each group. To be used with IFolderView2::SetGroupSubsetCount. FWF_SUBSETGROUPS = 0x20000000, + /// Windows Vista and later. Use the search folder for stacking and searching. FWF_USESEARCHFOLDER = 0x40000000, - /// Windows Vista and later. Ensure right-to-left reading layout in a right-to-left system. Without this flag, the view displays strings from left-to-right both on systems set to left-to-right and right-to-left reading layout, which ensures that file names display correctly. + + /// + /// Windows Vista and later. Ensure right-to-left reading layout in a right-to-left system. Without this flag, the view displays + /// strings from left-to-right both on systems set to left-to-right and right-to-left reading layout, which ensures that file + /// names display correctly. + /// FWF_ALLOWRTLREADING = 0x80000000, } /// The view mode of a folder. + [PInvokeData("shobjidl.h")] public enum FOLDERVIEWMODE { /// The view should determine the best option. FVM_AUTO = -1, + /// Windows 7 and later. The view should display content mode. FVM_CONTENT = 8, + /// Object names and other selected information, such as the size or date last updated, are shown. FVM_DETAILS = 4, + /// The view should display medium-size icons. FVM_ICON = 1, + /// Object names are displayed in a list view. FVM_LIST = 3, + /// The view should display small icons. FVM_SMALLICON = 2, + /// The view should display thumbnail icons. FVM_THUMBNAIL = 5, + /// The view should display icons in a filmstrip format. FVM_THUMBSTRIP = 7, + /// The view should display large icons. FVM_TILE = 6, } /// - /// Used by methods of the IFolderViewOptions interface to activate Windows Vista options not supported by default in Windows 7 and later systems as well as deactivating new Windows 7 options. + /// Used by methods of the IFolderViewOptions interface to activate Windows Vista options not supported by default in Windows 7 and + /// later systems as well as deactivating new Windows 7 options. /// + [PInvokeData("shobjidl.h")] [Flags] public enum FOLDERVIEWOPTIONS { /// Do not use any special options. FVO_DEFAULT = 0x00000000, - /// Use the Windows Vista list view. This can be used to maintain continuity between systems so that users are presented with an expected view. At this time, setting this flag has the effective, though not literal, result of the application of the FVO_CUSTOMPOSITION and FVO_CUSTOMORDERING flags. However, this could change. Applications should be specific about the behaviors that they require. For instance, if an application requires custom positioning of its items, it should not rely on FVO_VISTALAYOUT to provide it, but instead explicitly apply the FVO_CUSTOMPOSITION flag. + + /// + /// Use the Windows Vista list view. This can be used to maintain continuity between systems so that users are presented with an + /// expected view. At this time, setting this flag has the effective, though not literal, result of the application of the + /// FVO_CUSTOMPOSITION and FVO_CUSTOMORDERING flags. However, this could change. Applications should be specific about the + /// behaviors that they require. For instance, if an application requires custom positioning of its items, it should not rely on + /// FVO_VISTALAYOUT to provide it, but instead explicitly apply the FVO_CUSTOMPOSITION flag. + /// FVO_VISTALAYOUT = 0x00000001, - /// Items require custom positioning within the space of the view. Those items are positioned to specific coordinates. This option is not active by default in the Windows 7 view. + + /// + /// Items require custom positioning within the space of the view. Those items are positioned to specific coordinates. This + /// option is not active by default in the Windows 7 view. + /// FVO_CUSTOMPOSITION = 0x00000002, - /// Items require custom ordering within the view. This option is not active by default in the Windows 7 view. When it is active, the user can reorder the view by dragging items to their desired locations. + + /// + /// Items require custom ordering within the view. This option is not active by default in the Windows 7 view. When it is active, + /// the user can reorder the view by dragging items to their desired locations. + /// FVO_CUSTOMORDERING = 0x00000004, - /// Tiles and Details displays can contain hyperlinks. This option is not active by default in the Windows 7 view. When hyperlinks are displayed, they are updated to the Windows 7 view. + + /// + /// Tiles and Details displays can contain hyperlinks. This option is not active by default in the Windows 7 view. When + /// hyperlinks are displayed, they are updated to the Windows 7 view. + /// FVO_SUPPORTHYPERLINKS = 0x00000008, - /// Do not display animations in the view. This option was introduced in Windows 7 and is active by default in the Windows 7 view. + + /// + /// Do not display animations in the view. This option was introduced in Windows 7 and is active by default in the Windows 7 view. + /// FVO_NOANIMATIONS = 0x00000010, + /// Do not show scroll tips. This option was introduced in Windows 7 and is active by default in the Windows 7 view. FVO_NOSCROLLTIPS = 0x00000020, } /// Flags specifying the folder to be browsed. + [PInvokeData("shobjidl.h")] [Flags] public enum SBSP : uint { @@ -186,22 +273,36 @@ namespace Vanara.PInvoke /// Enable auto-navigation. SBSP_ALLOW_AUTONAVIGATE = 0x00010000, - /// Microsoft Internet Explorer 6 Service Pack 2 (SP2) and later. The navigation was possibly initiated by a webpage with scripting code already present on the local system. + /// + /// Microsoft Internet Explorer 6 Service Pack 2 (SP2) and later. The navigation was possibly initiated by a webpage with + /// scripting code already present on the local system. + /// SBSP_CALLERUNTRUSTED = 0x00800000, - /// Windows 7 and later. Do not add a new entry to the travel log. When the user enters a search term in the search box and subsequently refines the query, the browser navigates forward but does not add an additional travel log entry. + /// + /// Windows 7 and later. Do not add a new entry to the travel log. When the user enters a search term in the search box and + /// subsequently refines the query, the browser navigates forward but does not add an additional travel log entry. + /// SBSP_CREATENOHISTORY = 0x00100000, - /// Use default behavior, which respects the view option (the user setting to create new windows or to browse in place). In most cases, calling applications should use this flag. + /// + /// Use default behavior, which respects the view option (the user setting to create new windows or to browse in place). In most + /// cases, calling applications should use this flag. + /// SBSP_DEFBROWSER = 0x0000, /// Use the current window. SBSP_DEFMODE = 0x0000, - /// Specifies a folder tree for the new browse window. If the current browser does not match the SBSP_EXPLOREMODE of the browse object call, a new window is opened. + /// + /// Specifies a folder tree for the new browse window. If the current browser does not match the SBSP_EXPLOREMODE of the browse + /// object call, a new window is opened. + /// SBSP_EXPLOREMODE = 0x0020, - /// Windows Internet Explorer 7 and later. If allowed by current registry settings, give the browser a destination to navigate to. + /// + /// Windows Internet Explorer 7 and later. If allowed by current registry settings, give the browser a destination to navigate to. + /// SBSP_FEEDNAVIGATION = 0x20000000, /// Not supported. Do not use. @@ -231,7 +332,10 @@ namespace Vanara.PInvoke /// Do not transfer the browsing history to the new window. SBSP_NOTRANSFERHIST = 0x0080, - /// Specifies no folder tree for the new browse window. If the current browser does not match the SBSP_OPENMODE of the browse object call, a new window is opened. + /// + /// Specifies no folder tree for the new browse window. If the current browser does not match the SBSP_OPENMODE of the browse + /// object call, a new window is opened. + /// SBSP_OPENMODE = 0x0010, /// Browse the parent folder, ignore the PIDL. @@ -252,10 +356,16 @@ namespace Vanara.PInvoke /// Microsoft Internet Explorer 6 Service Pack 2 (SP2) and later. The navigate should allow ActiveX prompts. SBSP_TRUSTEDFORACTIVEX = 0x10000000, - /// Microsoft Internet Explorer 6 Service Pack 2 (SP2) and later. The new window is the result of a user initiated action. Trust the new window if it immediately attempts to download content. + /// + /// Microsoft Internet Explorer 6 Service Pack 2 (SP2) and later. The new window is the result of a user initiated action. Trust + /// the new window if it immediately attempts to download content. + /// SBSP_TRUSTFIRSTDOWNLOAD = 0x01000000, - /// Microsoft Internet Explorer 6 Service Pack 2 (SP2) and later. The window is navigating to an untrusted, non-HTML file. If the user attempts to download the file, do not allow the download. + /// + /// Microsoft Internet Explorer 6 Service Pack 2 (SP2) and later. The window is navigating to an untrusted, non-HTML file. If the + /// user attempts to download the file, do not allow the download. + /// SBSP_UNTRUSTEDFORDOWNLOAD = 0x02000000, /// Write no history of this navigation in the history Shell folder. @@ -263,199 +373,351 @@ namespace Vanara.PInvoke } /// Flags used by IShellFolderViewCB::MessageSFVCB. + [PInvokeData("shobjidl.h")] public enum SFVM { /// Allows the callback object to provide a page to add to the Properties property sheet of the selected object. SFVM_ADDPROPERTYPAGES = 47, + /// Allows the callback object to request that enumeration be done on a background thread. SFVM_BACKGROUNDENUM = 32, + /// Notifies the callback object that background enumeration is complete. SFVM_BACKGROUNDENUMDONE = 48, - /// Notifies the callback object that the user has clicked a column header to sort the list of objects in the folder view. + + /// + /// Notifies the callback object that the user has clicked a column header to sort the list of objects in the folder view. + /// SFVM_COLUMNCLICK = 24, + /// Allows the callback object to specify the number of items in the folder view. SFVM_DEFITEMCOUNT = 26, + /// Allows the callback object to specify the view mode. SFVM_DEFVIEWMODE = 27, + /// Notifies the callback function that a drag-and-drop operation has begun. SFVM_DIDDRAGDROP = 36, + /// Notifies the callback object that an event has taken place that affects one of its items. SFVM_FSNOTIFY = 14, - /// Allows the callback object to specify that an animation be displayed while items are enumerated on a background thread. + + /// + /// Allows the callback object to specify that an animation be displayed while items are enumerated on a background thread. + /// SFVM_GETANIMATION = 68, + /// Allows the callback object to add buttons to the toolbar. SFVM_GETBUTTONINFO = 5, + /// Allows the callback object to specify the buttons to be added to the toolbar. SFVM_GETBUTTONS = 6, - /// Allows the callback object to provide the details for an item in a Shell folder. Use only if a call to GetDetailsOf fails and there is no GetDetailsOf method available to call. + + /// + /// Allows the callback object to provide the details for an item in a Shell folder. Use only if a call to GetDetailsOf fails and + /// there is no GetDetailsOf method available to call. + /// SFVM_GETDETAILSOF = 23, + /// Allows the callback object to specify a help text string for menu items or toolbar buttons. SFVM_GETHELPTEXT = 3, + /// Allows the callback object to specify a Help file and topic. SFVM_GETHELPTOPIC = 63, + /// Specifies which events will generate an SFVM_FSNOTIFY message for a given item. SFVM_GETNOTIFY = 49, + /// Allows the callback object to provide the status bar pane in which to display the Internet zone information. SFVM_GETPANE = 59, + /// Allows the callback object to specify default sorting parameters. SFVM_GETSORTDEFAULTS = 53, + /// Allows the callback object to specify a tooltip text string for menu items or toolbar buttons. SFVM_GETTOOLTIPTEXT = 4, + /// Allows the callback object to provide Internet zone information. SFVM_GETZONE = 58, + /// Allows the callback object to modify an item's context menu. SFVM_INITMENUPOPUP = 7, + /// Notifies the callback object that one of its toolbar or menu commands has been invoked. SFVM_INVOKECOMMAND = 2, + /// Allows the callback object to merge menu items into the Windows Explorer menus. SFVM_MERGEMENU = 1, + /// Allows the callback object to register a folder so that changes to that folder's view will generate notifications. SFVM_QUERYFSNOTIFY = 25, - /// Notifies the callback object of the container site. This is used only when IObjectWithSite::SetSite is not supported and SHCreateShellFolderViewEx is used. + + /// + /// Notifies the callback object of the container site. This is used only when IObjectWithSite::SetSite is not supported and + /// SHCreateShellFolderViewEx is used. + /// SFVM_SETISFV = 39, + /// Notifies the callback object that the folder view has been resized. SFVM_SIZE = 57, - /// Allows the callback object to specify the view's PIDL. This is used only when SetIDList and IPersistFolder2::GetCurFolder have failed. + + /// + /// Allows the callback object to specify the view's PIDL. This is used only when SetIDList and IPersistFolder2::GetCurFolder + /// have failed. + /// SFVM_THISIDLIST = 41, + /// Notifies the callback object that a menu is being removed. SFVM_UNMERGEMENU = 28, + /// Allows the callback object to request that the status bar be updated. SFVM_UPDATESTATUSBAR = 31, + /// Notifies the callback object that the folder view window is being created. SFVM_WINDOWCREATED = 15, } /// The type of view requested. + [PInvokeData("shobjidl.h")] public enum SV2GV : int { /// Current Shell view. SV2GV_CURRENTVIEW = -1, + /// Default Shell view. SV2GV_DEFAULTVIEW = -2, } /// Flags that specify details of the view being created. + [PInvokeData("shobjidl.h")] + [Flags] public enum SV3CVW3_FLAGS { /// The default view. SV3CVW3_DEFAULT = 0x00000000, + /// In the case of an error, the view should fail silently rather than displaying a UI. SV3CVW3_NONINTERACTIVE = 0x00000001, + /// The view mode set by IShellView3::CreateViewWindow3 overrides the saved view state. SV3CVW3_FORCEVIEWMODE = 0x00000002, + /// Folder flags set by IShellView3::CreateViewWindow3 override the saved view state. SV3CVW3_FORCEFOLDERFLAGS = 0x00000004, } /// Selection flags for IShellView objects. [Flags] + [PInvokeData("shobjidl.h")] public enum SVSIF : uint { /// Deselect the item. SVSI_DESELECT = 0x00000000, + /// Select the item. SVSI_SELECT = 0x00000001, + /// Put the name of the item into rename mode. This value includes SVSI_SELECT. SVSI_EDIT = 0x00000003, + /// Deselect all but the selected item. If the item parameter is NULL, deselect all items. SVSI_DESELECTOTHERS = 0x00000004, - /// In the case of a folder that cannot display all of its contents on one screen, display the portion that contains the selected item. + + /// + /// In the case of a folder that cannot display all of its contents on one screen, display the portion that contains the selected item. + /// SVSI_ENSUREVISIBLE = 0x00000008, - /// Give the selected item the focus when multiple items are selected, placing the item first in any list of the collection returned by a method. + + /// + /// Give the selected item the focus when multiple items are selected, placing the item first in any list of the collection + /// returned by a method. + /// SVSI_FOCUSED = 0x00000010, + /// Convert the input point from screen coordinates to the list-view client coordinates. SVSI_TRANSLATEPT = 0x00000020, + /// Mark the item so that it can be queried using IFolderView::GetSelectionMarkedItem. SVSI_SELECTIONMARK = 0x00000040, - /// Allows the window's default view to position the item. In most cases, this will place the item in the first available position. However, if the call comes during the processing of a mouse-positioned context menu, the position of the context menu is used to position the item. + + /// + /// Allows the window's default view to position the item. In most cases, this will place the item in the first available + /// position. However, if the call comes during the processing of a mouse-positioned context menu, the position of the context + /// menu is used to position the item. + /// SVSI_POSITIONITEM = 0x00000080, + /// The item should be checked. This flag is used with items in views where the checked mode is supported. SVSI_CHECK = 0x00000100, - /// The second check state when the view is in tri-check mode, in which there are three values for the checked state. You can indicate tri-check mode by specifying FWF_TRICHECKSELECT in IFolderView2::SetCurrentFolderFlags. The 3 states for FWF_TRICHECKSELECT are unchecked, SVSI_CHECK and SVSI_CHECK2. + + /// + /// The second check state when the view is in tri-check mode, in which there are three values for the checked state. You can + /// indicate tri-check mode by specifying FWF_TRICHECKSELECT in IFolderView2::SetCurrentFolderFlags. The 3 states for + /// FWF_TRICHECKSELECT are unchecked, SVSI_CHECK and SVSI_CHECK2. + /// SVSI_CHECK2 = 0x00000200, + /// Selects the item and marks it as selected by the keyboard. This value includes SVSI_SELECT. SVSI_KEYBOARDSELECT = 0x00000401, + /// An operation to select or focus an item should not also set focus on the view itself. SVSI_NOTAKEFOCUS = 0x40000000, } /// Flag specifying the activation state of the window. + [PInvokeData("shobjidl.h")] public enum SVUIA : uint { - /// Windows Explorer is about to destroy the Shell view window. The Shell view should remove all extended user interfaces. These are typically merged menus and merged modeless pop-up windows. + /// + /// Windows Explorer is about to destroy the Shell view window. The Shell view should remove all extended user interfaces. These + /// are typically merged menus and merged modeless pop-up windows. + /// SVUIA_DEACTIVATE = 0, - /// The Shell view is losing the input focus, or it has just been created without the input focus. The Shell view should be able to set menu items appropriate for the nonfocused state. This means no selection-specific items should be added. + + /// + /// The Shell view is losing the input focus, or it has just been created without the input focus. The Shell view should be able + /// to set menu items appropriate for the nonfocused state. This means no selection-specific items should be added. + /// SVUIA_ACTIVATE_NOFOCUS = 1, - /// Windows Explorer has just created the view window with the input focus. This means the Shell view should be able to set menu items appropriate for the focused state. + + /// + /// Windows Explorer has just created the view window with the input focus. This means the Shell view should be able to set menu + /// items appropriate for the focused state. + /// SVUIA_ACTIVATE_FOCUS = 2, - /// The Shell view is active without focus. This flag is only used when UIActivate is exposed through the IShellView2 interface. + + /// + /// The Shell view is active without focus. This flag is only used when UIActivate is exposed through the IShellView2 interface. + /// SVUIA_INPLACEACTIVATE = 3 } - /// Exposes methods that allow control of folder view options specific to the Windows 7 and later views. - [PInvokeData("Shobjidl.h", MinClient = PInvokeClient.Windows7)] + /// + /// Exposes methods that allow control of folder view options specific to the Windows 7 and later views. + /// + /// + /// When to Implement + /// + /// An implementation of this interface is provided with Windows as part of CLSID_ExplorerBrowser and CLSID_ShellBrowser. Third + /// parties do not implement this interface. + /// + /// When to Use + /// + /// By default, the Windows 7 item view does not support custom positioning, custom ordering, or hyperlinks, which were supported in + /// the Windows Vista list view. Use this interface when you require those features of the older view. If, at some later time, the + /// item view adds support for those features, these options will automatically use the newer view rather than continuing to revert + /// to the older view as they currently do. + /// + /// Use this interface to turn off animation and scroll tip view options new to Windows 7. + /// Use this interface to retrieve the current view settings for all of those options. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl/nn-shobjidl-ifolderviewoptions + [PInvokeData("shobjidl.h", MSDNShortId = "4831e62c-45e4-435d-b926-0e140cbfb6fc", MinClient = PInvokeClient.Windows7)] [ComImport, Guid("3cc974d2-b302-4d36-ad3e-06d93f695d3f"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IFolderViewOptions { /// Sets specified options for the view. - /// A bitmask made up of one or more of the FOLDERVIEWOPTIONS flags to indicate which options' are being changed. Values in fvoFlags not included in this mask are ignored. - /// A bitmask that contains the new values for the options specified in fvoMask. To enable an option, the bitmask should include the FOLDERVIEWOPTIONS flag for that option. To disable an option, the bit used for that FOLDERVIEWOPTIONS flag should be 0. + /// + /// A bitmask made up of one or more of the FOLDERVIEWOPTIONS flags to indicate which options' are being changed. Values in + /// fvoFlags not included in this mask are ignored. + /// + /// + /// A bitmask that contains the new values for the options specified in fvoMask. To enable an option, the bitmask should include + /// the FOLDERVIEWOPTIONS flag for that option. To disable an option, the bit used for that FOLDERVIEWOPTIONS flag should be 0. + /// void SetFolderViewOptions(FOLDERVIEWOPTIONS fvoMask, FOLDERVIEWOPTIONS fvoFlags); + /// Retrieves the current set of options for the view. - /// A bitmask that, when this method returns successfully, receives the FOLDERVIEWOPTIONS values that are currently set. + /// + /// A bitmask that, when this method returns successfully, receives the FOLDERVIEWOPTIONS values that are currently set. + /// FOLDERVIEWOPTIONS GetFolderViewOptions(); } /// - /// Implemented by hosts of Shell views (objects that implement IShellView). Exposes methods that provide services for the view it is hosting and other - /// objects that run in the context of the Explorer window. + /// Implemented by hosts of Shell views (objects that implement IShellView). Exposes methods that provide services for the + /// view it is hosting and other objects that run in the context of the Explorer window. /// - /// - [PInvokeData("Shobjidl.h")] + // https://msdn.microsoft.com/en-us/library/windows/desktop/bb775123(v=vs.85).aspx + [PInvokeData("Shobjidl.h", MSDNShortId = "bb775123")] [ComImport, Guid("000214E2-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IShellBrowser : IOleWindow { - /// Retrieves a handle to one of the windows participating in in-place activation (frame, document, parent, or in-place object window). + /// + /// Retrieves a handle to one of the windows participating in in-place activation (frame, document, parent, or in-place object window). + /// /// A pointer to a variable that receives the window handle. new IntPtr GetWindow(); + /// Determines whether context-sensitive help mode should be entered during an in-place activation session. /// true if help mode should be entered; false if it should be exited. new void ContextSensitiveHelp([MarshalAs(UnmanagedType.Bool)] bool fEnterMode); - /// Allows the container to insert its menu groups into the composite menu that is displayed when an extended namespace is being viewed or used. + + /// + /// Allows the container to insert its menu groups into the composite menu that is displayed when an extended namespace is being + /// viewed or used. + /// /// A handle to an empty menu. - /// The address of an OLEMENUGROUPWIDTHS array of six LONG values. The container fills in elements 0, 2, and 4 to reflect the number of menu elements it provided in the File, View, and Window menu groups. + /// + /// The address of an OLEMENUGROUPWIDTHS array of six LONG values. The container fills in elements 0, 2, and 4 to reflect the + /// number of menu elements it provided in the File, View, and Window menu groups. + /// void InsertMenusSB(IntPtr hmenuShared, ref OLEMENUGROUPWIDTHS lpMenuWidths); + /// Installs the composite menu in the view window. - /// A handle to the composite menu constructed by calls to IShellBrowser::InsertMenusSB and the InsertMenu function. + /// + /// A handle to the composite menu constructed by calls to IShellBrowser::InsertMenusSB and the InsertMenu function. + /// /// /// The view's window handle. void SetMenuSB(IntPtr hmenuShared, IntPtr holemenuRes, IntPtr hwndActiveObject); - /// Permits the container to remove any of its menu elements from the in-place composite menu and to free all associated resources. - /// A handle to the in-place composite menu that was constructed by calls to IShellBrowser::InsertMenusSB and the InsertMenu function. + + /// + /// Permits the container to remove any of its menu elements from the in-place composite menu and to free all associated resources. + /// + /// + /// A handle to the in-place composite menu that was constructed by calls to IShellBrowser::InsertMenusSB and the InsertMenu function. + /// void RemoveMenusSB(IntPtr hmenuShared); + /// Sets and displays status text about the in-place object in the container's frame-window status bar. /// A pointer to a null-terminated character string that contains the message to display. void SetStatusTextSB([MarshalAs(UnmanagedType.LPWStr)] string pszStatusText); + /// Tells Windows Explorer to enable or disable its modeless dialog boxes. - /// Specifies whether the modeless dialog boxes are to be enabled or disabled. If this parameter is nonzero, modeless dialog boxes are enabled. If this parameter is zero, modeless dialog boxes are disabled. + /// + /// Specifies whether the modeless dialog boxes are to be enabled or disabled. If this parameter is nonzero, modeless dialog + /// boxes are enabled. If this parameter is zero, modeless dialog boxes are disabled. + /// void EnableModelessSB([MarshalAs(UnmanagedType.Bool)] bool fEnable); + /// Translates accelerator keystrokes intended for the browser's frame while the view is active. /// The address of an MSG structure containing the keystroke message. - /// The command identifier value corresponding to the keystroke in the container-provided accelerator table. Containers should use this value instead of translating again. + /// + /// The command identifier value corresponding to the keystroke in the container-provided accelerator table. Containers should + /// use this value instead of translating again. + /// void TranslateAcceleratorSB(ref MSG pmsg, ushort wID); + /// Informs Windows Explorer to browse to another folder. - /// The address of an ITEMIDLIST (item identifier list) structure that specifies an object's location. This value is dependent on the flag or flags set in the wFlags parameter. + /// + /// The address of an ITEMIDLIST (item identifier list) structure that specifies an object's location. This value is dependent on + /// the flag or flags set in the wFlags parameter. + /// /// Flags specifying the folder to be browsed. void BrowseObject(PIDL pidl, SBSP wFlags); + /// Gets an IStream interface that can be used for storage of view-specific state information. /// Read/write access of the IStream interface. /// The address that receives the IStream interface pointer. [return: MarshalAs(UnmanagedType.Interface)] IStream GetViewStateStream(STGM grfMode); + /// Gets the window handle to a browser control. /// The control handle that is being requested. /// The address of the window handle to the Windows Explorer control. IntPtr GetControlWindow(FCW id); + /// Sends control messages to either the toolbar or the status bar in a Windows Explorer window. /// An identifier for either a toolbar (FCW_TOOLBAR) or for a status bar window (FCW_STATUS). /// The message to be sent to the control. @@ -463,14 +725,20 @@ namespace Vanara.PInvoke /// The value depends on the message specified in the uMsg parameter. /// The address of the return value of the SendMessage function. IntPtr SendControlMsg(FCW id, uint uMsg, IntPtr wParam, IntPtr lParam); + /// Retrieves the currently active (displayed) Shell view object. /// The address of the pointer to the currently active Shell view object. [return: MarshalAs(UnmanagedType.Interface)] IShellView QueryActiveShellView(); + /// Called by the Shell view when the view window or one of its child windows gets the focus or becomes active. /// Address of the view object's IShellView pointer. void OnViewWindowActive(IShellView ppshv); - /// This method has no effect on Windows Vista or later operating systems. Adds toolbar items to Windows Explorer's toolbar. + + /// + /// This method has no effect on Windows Vista or later operating systems. Adds toolbar items to Windows + /// Explorer's toolbar. + /// /// The address of an array of TBBUTTON structures. /// The number of TBBUTTON structures in the lpButtons array. /// Flags specifying where the toolbar buttons should go. @@ -478,9 +746,12 @@ namespace Vanara.PInvoke } /// - /// Exposes a method that allows communication between Windows Explorer and a folder view implemented using the system folder view object (the IShellView - /// object returned through SHCreateShellFolderView) so that the folder view can be notified of events and modify its view accordingly. + /// Exposes a method that allows communication between Windows Explorer and a folder view implemented using the system folder view + /// object (the IShellView object returned through SHCreateShellFolderView) so that the folder view can be notified of + /// events and modify its view accordingly. /// + // https://msdn.microsoft.com/en-us/library/windows/desktop/bb774967(v=vs.85).aspx + [PInvokeData("Shlobj.h", MSDNShortId = "bb774967")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("2047E320-F2A9-11CE-AE65-08002B2E1262")] public interface IShellFolderViewCB { @@ -494,61 +765,100 @@ namespace Vanara.PInvoke HRESULT MessageSFVCB(SFVM uMsg, IntPtr wParam, IntPtr lParam, ref IntPtr plResult); } - /// Exposes methods that present a view in the Windows Explorer or folder windows. - /// - [PInvokeData("Shobjidl.h")] + /// + /// Exposes methods that present a view in the Windows Explorer or folder windows. + /// + /// + /// + /// The object that exposes IShellView is typically created by a call to the IShellFolder::CreateViewObject method. This + /// provides the channel of communication between a view object and Windows Explorer's outermost frame window. The communication + /// involves the translation of messages, the state of the frame window (activated or deactivated), the state of the document window + /// (activated or deactivated), and the merging of menus and toolbar items. + /// + /// + /// This interface is implemented by namespace extensions that display themselves in Windows Explorer's namespace. This object is + /// created by the IShellFolder object that hosts the view. + /// + /// These methods are used by the Shell view's Windows Explorer window to manipulate objects while they are active. + /// IShellView is derived from IOleWindow. The listed methods are specific to IShellView. + /// + /// A special instance of IShellView known as the default Shell folder view object can be created by calling + /// SHCreateShellFolderView or SHCreateShellFolderViewEx. This instance can be differentiated from standard implementations by + /// calling QueryInterface on an IShellView object using the IID_CDefView IID. This call succeeds only when made on the + /// default Shell folder view object. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nn-shobjidl_core-ishellview + [PInvokeData("shobjidl_core.h", MSDNShortId = "91438583-e4f1-456f-a130-2a45846fd725")] [ComImport, Guid("000214E3-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IShellView : IOleWindow { - /// Retrieves a handle to one of the windows participating in in-place activation (frame, document, parent, or in-place object window). + /// + /// Retrieves a handle to one of the windows participating in in-place activation (frame, document, parent, or in-place object window). + /// /// A pointer to a variable that receives the window handle. new IntPtr GetWindow(); + /// Determines whether context-sensitive help mode should be entered during an in-place activation session. /// true if help mode should be entered; false if it should be exited. new void ContextSensitiveHelp([MarshalAs(UnmanagedType.Bool)] bool fEnterMode); + /// Translates keyboard shortcut (accelerator) key strokes when a namespace extension's view has the focus. /// The address of the message to be translated. void TranslateAccelerator(ref MSG lpmsg); + /// Enables or disables modeless dialog boxes. This method is not currently implemented. /// true to enable modeless dialog box windows or false to disable them. void EnableModeless([MarshalAs(UnmanagedType.Bool)] bool enable); + /// - /// Called when the activation state of the view window is changed by an event that is not caused by the Shell view itself. For example, if the TAB - /// key is pressed when the tree has the focus, the view should be given the focus. + /// Called when the activation state of the view window is changed by an event that is not caused by the Shell view itself. For + /// example, if the TAB key is pressed when the tree has the focus, the view should be given the focus. /// /// Flag specifying the activation state of the window. void UIActivate(SVUIA uState); + /// Refreshes the view's contents in response to user input. void Refresh(); - /// Creates a view window. This can be either the right pane of Windows Explorer or the client window of a folder window. + + /// + /// Creates a view window. This can be either the right pane of Windows Explorer or the client window of a folder window. + /// /// - /// The address of the IShellView interface of the view window being exited. Views can use this parameter to communicate with a previous view of the - /// same implementation. This interface can be used to optimize browsing between like views. This pointer may be NULL. + /// The address of the IShellView interface of the view window being exited. Views can use this parameter to communicate with a + /// previous view of the same implementation. This interface can be used to optimize browsing between like views. This pointer + /// may be NULL. /// /// The address of a FOLDERSETTINGS structure. The view should use this when creating its view. /// - /// The address of the current instance of the IShellBrowser interface. The view should call this interface's AddRef method and keep the interface - /// pointer to allow communication with the Windows Explorer window. + /// The address of the current instance of the IShellBrowser interface. The view should call this interface's AddRef method and + /// keep the interface pointer to allow communication with the Windows Explorer window. /// /// The dimensions of the new view, in client coordinates. /// The address of the window handle being created. IntPtr CreateViewWindow(IShellView psvPrevious, ref FOLDERSETTINGS pfs, IShellBrowser psb, ref RECT prcView); + /// Destroys the view window. void DestroyViewWindow(); + /// Gets the current information. /// A FOLDERSETTINGS structure to receive the settings. FOLDERSETTINGS GetCurrentInfo(); + /// Allows the view to add pages to the Options property sheet from the View menu. /// Reserved. /// The address of the callback function used to add the pages. /// A value that must be passed as the callback function's lparam parameter. void AddPropertySheetPages(uint dwReserved, [In] AddPropSheetPageProc lpfn, [In] IntPtr lparam); + /// Saves the Shell's view settings so the current state can be restored during a subsequent browsing session. void SaveViewState(); + /// Changes the selection state of one or more items within the Shell view window. /// The address of the ITEMIDLIST structure. /// One of the _SVSIF constants that specify the type of selection to apply. void SelectItem(PIDL pidlItem, SVSIF uFlags); + /// Gets an interface that refers to data presented in the view. /// The constants that refer to an aspect of the view. /// The identifier of the COM interface being requested. @@ -557,77 +867,118 @@ namespace Vanara.PInvoke object GetItemObject(SVGIO uItem, [In, MarshalAs(UnmanagedType.LPStruct)] Guid riid); } - /// Extends the capabilities of IShellView. - /// - [PInvokeData("Shobjidl.h")] + /// + /// Extends the capabilities of IShellView. + /// + /// + /// This interface also provides the methods of the IShellView interface, from which it inherits. + /// When to Implement + /// Implement IShellView2 if your namespace extension provides services to clients beyond those in IShellView . + /// When to Use + /// + /// You do not call this interface directly. IShellView2 is used by the operating system only when it has confirmed that your + /// application is aware of this interface. Objects that expose IShellView and IShellView2 are usually created by other Shell folder objects. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nn-shobjidl_core-ishellview2 + [PInvokeData("shobjidl_core.h", MSDNShortId = "a61aec39-406d-4066-941d-e788d64f4310")] [ComImport, Guid("88E39E80-3578-11CF-AE69-08002B2E1262"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IShellView2 : IShellView { - /// Retrieves a handle to one of the windows participating in in-place activation (frame, document, parent, or in-place object window). + /// + /// Retrieves a handle to one of the windows participating in in-place activation (frame, document, parent, or in-place object window). + /// /// A pointer to a variable that receives the window handle. new IntPtr GetWindow(); + /// Determines whether context-sensitive help mode should be entered during an in-place activation session. /// true if help mode should be entered; false if it should be exited. new void ContextSensitiveHelp([MarshalAs(UnmanagedType.Bool)] bool fEnterMode); + /// Translates keyboard shortcut (accelerator) key strokes when a namespace extension's view has the focus. /// The address of the message to be translated. new void TranslateAccelerator(ref MSG lpmsg); + /// Enables or disables modeless dialog boxes. This method is not currently implemented. /// true to enable modeless dialog box windows or false to disable them. new void EnableModeless([MarshalAs(UnmanagedType.Bool)] bool enable); + /// - /// Called when the activation state of the view window is changed by an event that is not caused by the Shell view itself. For example, if the TAB - /// key is pressed when the tree has the focus, the view should be given the focus. + /// Called when the activation state of the view window is changed by an event that is not caused by the Shell view itself. For + /// example, if the TAB key is pressed when the tree has the focus, the view should be given the focus. /// /// Flag specifying the activation state of the window. new void UIActivate(SVUIA uState); + /// Refreshes the view's contents in response to user input. new void Refresh(); - /// Creates a view window. This can be either the right pane of Windows Explorer or the client window of a folder window. + + /// + /// Creates a view window. This can be either the right pane of Windows Explorer or the client window of a folder window. + /// /// - /// The address of the IShellView interface of the view window being exited. Views can use this parameter to communicate with a previous view of the - /// same implementation. This interface can be used to optimize browsing between like views. This pointer may be NULL. + /// The address of the IShellView interface of the view window being exited. Views can use this parameter to communicate with a + /// previous view of the same implementation. This interface can be used to optimize browsing between like views. This pointer + /// may be NULL. /// /// The address of a FOLDERSETTINGS structure. The view should use this when creating its view. /// - /// The address of the current instance of the IShellBrowser interface. The view should call this interface's AddRef method and keep the interface - /// pointer to allow communication with the Windows Explorer window. + /// The address of the current instance of the IShellBrowser interface. The view should call this interface's AddRef method and + /// keep the interface pointer to allow communication with the Windows Explorer window. /// /// The dimensions of the new view, in client coordinates. /// The address of the window handle being created. new IntPtr CreateViewWindow(IShellView psvPrevious, ref FOLDERSETTINGS pfs, IShellBrowser psb, ref RECT prcView); + /// Destroys the view window. new void DestroyViewWindow(); + /// Gets the current information. /// A FOLDERSETTINGS structure to receive the settings. new FOLDERSETTINGS GetCurrentInfo(); + /// Allows the view to add pages to the Options property sheet from the View menu. /// Reserved. /// The address of the callback function used to add the pages. /// A value that must be passed as the callback function's lparam parameter. new void AddPropertySheetPages(uint dwReserved, [In] AddPropSheetPageProc lpfn, [In] IntPtr lparam); + /// Saves the Shell's view settings so the current state can be restored during a subsequent browsing session. new void SaveViewState(); + /// Changes the selection state of one or more items within the Shell view window. /// The address of the ITEMIDLIST structure. /// One of the _SVSIF constants that specify the type of selection to apply. new void SelectItem(PIDL pidlItem, SVSIF uFlags); + /// Gets an interface that refers to data presented in the view. /// The constants that refer to an aspect of the view. /// The identifier of the COM interface being requested. /// The address that receives the interface pointer. If an error occurs, the pointer returned must be NULL. [return: MarshalAs(UnmanagedType.IUnknown)] new object GetItemObject(SVGIO uItem, [In, MarshalAs(UnmanagedType.LPStruct)] Guid riid); - /// Requests the current or default Shell view, together with all other valid view identifiers (VIDs) supported by this implementation of IShellView2. + + /// + /// Requests the current or default Shell view, together with all other valid view identifiers (VIDs) supported by this + /// implementation of IShellView2. + /// /// A pointer to the GUID of the requested view. /// The type of view requested. void GetView([MarshalAs(UnmanagedType.LPStruct)] out Guid pvid, SV2GV uView); - /// Used to request the creation of a new Shell view window. It can be either the right pane of Windows Explorer or the client window of a folder window. + + /// + /// Used to request the creation of a new Shell view window. It can be either the right pane of Windows Explorer or the client + /// window of a folder window. + /// /// A pointer to an SV2CVW2_PARAMS structure that defines the new view window. void CreateViewWindow2(SV2CVW2_PARAMS lpParams); + /// Used to change an item's identifier. - /// A pointer to an ITEMIDLIST structure. The current identifier is passed in and is replaced by the new one. + /// + /// A pointer to an ITEMIDLIST structure. The current identifier is passed in and is replaced by the new one. + /// void HandleRename(PIDL pidlNew); + /// Selects and positions an item in a Shell View. /// A pointer to an ITEMIDLIST structure that uniquely identifies the item of interest. /// One of the _SVSIF constants that specify the type of selection to apply. @@ -635,85 +986,125 @@ namespace Vanara.PInvoke void SelectAndPositionItem(PIDL pidlItem, SVSIF flags, ref System.Drawing.Point point); } - /// Extends the capabilities of IShellView2 by providing a method to replace IShellView2::CreateViewWindow2. - /// - [PInvokeData("Shobjidl.h")] + /// + /// Extends the capabilities of IShellView2 by providing a method to replace IShellView2::CreateViewWindow2. + /// + /// + /// This interface also provides the methods of the IShellView and IShellView2 interfaces, from which it inherits. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl/nn-shobjidl-ishellview3 + [PInvokeData("shobjidl.h", MSDNShortId = "96b61e84-0d31-494d-a922-cd3dcd5735b9")] [ComImport(), Guid("ec39fa88-f8af-41c5-8421-38bed28f4673"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IShellView3 : IShellView2 { - /// Retrieves a handle to one of the windows participating in in-place activation (frame, document, parent, or in-place object window). + /// + /// Retrieves a handle to one of the windows participating in in-place activation (frame, document, parent, or in-place object window). + /// /// A pointer to a variable that receives the window handle. new IntPtr GetWindow(); + /// Determines whether context-sensitive help mode should be entered during an in-place activation session. /// true if help mode should be entered; false if it should be exited. new void ContextSensitiveHelp([MarshalAs(UnmanagedType.Bool)] bool fEnterMode); + /// Translates keyboard shortcut (accelerator) key strokes when a namespace extension's view has the focus. /// The address of the message to be translated. new void TranslateAccelerator(ref MSG lpmsg); + /// Enables or disables modeless dialog boxes. This method is not currently implemented. /// true to enable modeless dialog box windows or false to disable them. new void EnableModeless([MarshalAs(UnmanagedType.Bool)] bool enable); + /// - /// Called when the activation state of the view window is changed by an event that is not caused by the Shell view itself. For example, if the TAB - /// key is pressed when the tree has the focus, the view should be given the focus. + /// Called when the activation state of the view window is changed by an event that is not caused by the Shell view itself. For + /// example, if the TAB key is pressed when the tree has the focus, the view should be given the focus. /// /// Flag specifying the activation state of the window. new void UIActivate(SVUIA uState); + /// Refreshes the view's contents in response to user input. new void Refresh(); - /// Creates a view window. This can be either the right pane of Windows Explorer or the client window of a folder window. + + /// + /// Creates a view window. This can be either the right pane of Windows Explorer or the client window of a folder window. + /// /// - /// The address of the IShellView interface of the view window being exited. Views can use this parameter to communicate with a previous view of the - /// same implementation. This interface can be used to optimize browsing between like views. This pointer may be NULL. + /// The address of the IShellView interface of the view window being exited. Views can use this parameter to communicate with a + /// previous view of the same implementation. This interface can be used to optimize browsing between like views. This pointer + /// may be NULL. /// /// The address of a FOLDERSETTINGS structure. The view should use this when creating its view. /// - /// The address of the current instance of the IShellBrowser interface. The view should call this interface's AddRef method and keep the interface - /// pointer to allow communication with the Windows Explorer window. + /// The address of the current instance of the IShellBrowser interface. The view should call this interface's AddRef method and + /// keep the interface pointer to allow communication with the Windows Explorer window. /// /// The dimensions of the new view, in client coordinates. /// The address of the window handle being created. new IntPtr CreateViewWindow(IShellView psvPrevious, ref FOLDERSETTINGS pfs, IShellBrowser psb, ref RECT prcView); + /// Destroys the view window. new void DestroyViewWindow(); + /// Gets the current information. /// A FOLDERSETTINGS structure to receive the settings. new FOLDERSETTINGS GetCurrentInfo(); + /// Allows the view to add pages to the Options property sheet from the View menu. /// Reserved. /// The address of the callback function used to add the pages. /// A value that must be passed as the callback function's lparam parameter. new void AddPropertySheetPages(uint dwReserved, [In] AddPropSheetPageProc lpfn, [In] IntPtr lparam); + /// Saves the Shell's view settings so the current state can be restored during a subsequent browsing session. new void SaveViewState(); + /// Changes the selection state of one or more items within the Shell view window. /// The address of the ITEMIDLIST structure. /// One of the _SVSIF constants that specify the type of selection to apply. new void SelectItem(PIDL pidlItem, SVSIF uFlags); + /// Gets an interface that refers to data presented in the view. /// The constants that refer to an aspect of the view. /// The identifier of the COM interface being requested. /// The address that receives the interface pointer. If an error occurs, the pointer returned must be NULL. [return: MarshalAs(UnmanagedType.IUnknown)] new object GetItemObject(SVGIO uItem, [In, MarshalAs(UnmanagedType.LPStruct)] Guid riid); - /// Requests the current or default Shell view, together with all other valid view identifiers (VIDs) supported by this implementation of IShellView2. + + /// + /// Requests the current or default Shell view, together with all other valid view identifiers (VIDs) supported by this + /// implementation of IShellView2. + /// /// A pointer to the GUID of the requested view. /// The type of view requested. new void GetView([MarshalAs(UnmanagedType.LPStruct)] out Guid pvid, SV2GV uView); - /// Used to request the creation of a new Shell view window. It can be either the right pane of Windows Explorer or the client window of a folder window. + + /// + /// Used to request the creation of a new Shell view window. It can be either the right pane of Windows Explorer or the client + /// window of a folder window. + /// /// A pointer to an SV2CVW2_PARAMS structure that defines the new view window. new void CreateViewWindow2(SV2CVW2_PARAMS lpParams); + /// Used to change an item's identifier. - /// A pointer to an ITEMIDLIST structure. The current identifier is passed in and is replaced by the new one. + /// + /// A pointer to an ITEMIDLIST structure. The current identifier is passed in and is replaced by the new one. + /// new void HandleRename(PIDL pidlNew); + /// Selects and positions an item in a Shell View. /// A pointer to an ITEMIDLIST structure that uniquely identifies the item of interest. /// One of the _SVSIF constants that specify the type of selection to apply. /// A pointer to a POINT structure containing the new position. new void SelectAndPositionItem(PIDL pidlItem, SVSIF flags, ref System.Drawing.Point point); - /// Requests the creation of a new Shell view window. The view can be either the right pane of Windows Explorer or the client window of a folder window. This method replaces CreateViewWindow2. + + /// + /// Requests the creation of a new Shell view window. The view can be either the right pane of Windows Explorer or the client + /// window of a folder window. This method replaces CreateViewWindow2. + /// /// A pointer to an IShellBrowser interface to provide namespace extension services. - /// A pointer to an IShellView interface that represents the previous view in the Windows Explorer or folder window. + /// + /// A pointer to an IShellView interface that represents the previous view in the Windows Explorer or folder window. + /// /// Flags that specify details of the view being created. /// A bitwise mask that specifies which folder options specified in dwFlags are to be used. /// A bitwise value that contains the folder options, as FOLDERFLAGS, to use in the new view. @@ -732,6 +1123,7 @@ namespace Vanara.PInvoke { /// Folder view mode. public FOLDERVIEWMODE ViewMode; + /// A set of flags that indicate the options for the folder. public FOLDERFLAGS fFlags; @@ -745,32 +1137,42 @@ namespace Vanara.PInvoke } } - /// Holds the parameters for the IShellView2::CreateViewWindow2 method. - [PInvokeData("Shobjidl.h")] + /// Holds the parameters for the IShellView2::CreateViewWindow2 method. + // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/ns-shobjidl_core-_sv2cvw2_params + // typedef struct _SV2CVW2_PARAMS { DWORD cbSize; IShellView *psvPrev; LPCFOLDERSETTINGS pfs; IShellBrowser *psbOwner; RECT *prcView; const SHELLVIEWID *pvid; HWND hwndView; } SV2CVW2_PARAMS, *LPSV2CVW2_PARAMS; + [PInvokeData("shobjidl_core.h", MSDNShortId = "7e165654-74ea-4d8b-81b7-11257f87af53")] [StructLayout(LayoutKind.Sequential)] public class SV2CVW2_PARAMS : IDisposable { /// The size of the structure. public uint cbSize; + /// - /// A pointer to the IShellView interface of the previous view. A Shell view can use this parameter to communicate with a previous view with the same - /// implementation. It can also be used to optimize browsing between like views. This parameter may be NULL. + /// A pointer to the IShellView interface of the previous view. A Shell view can use this parameter to communicate with a + /// previous view with the same implementation. It can also be used to optimize browsing between like views. This parameter may + /// be NULL. /// public IShellView psvPrev; + /// A FOLDERSETTINGS structure with information needed to create the view. private IntPtr _pfs; + /// - /// A pointer to the current instance of the IShellBrowser interface of the parent Shell browser. IShellView2::CreateViewWindow2 should call this - /// interface's AddRef method and store the interface pointer. It can be used for communication with the Windows Explorer window. + /// A pointer to the current instance of the IShellBrowser interface of the parent Shell browser. IShellView2::CreateViewWindow2 + /// should call this interface's AddRef method and store the interface pointer. It can be used for communication with the Windows + /// Explorer window. /// public IShellBrowser psbOwner; + /// A RECT structure that defines the view's display area. private IntPtr _prcView; + /// - /// A pointer to a view ID. The view ID can be one of the Windows-defined VIDs or a custom, view-defined VID. This value takes precedence over the - /// view mode designated in the FOLDERSETTINGS structure pointed to by pfs. + /// A pointer to a view ID. The view ID can be one of the Windows-defined VIDs or a custom, view-defined VID. This value takes + /// precedence over the view mode designated in the FOLDERSETTINGS structure pointed to by pfs. /// private IntPtr _pvid; + /// A window handle to the new Shell view. public IntPtr hwndView; @@ -780,8 +1182,8 @@ namespace Vanara.PInvoke /// The current instance of the IShellBrowser interface of the parent Shell browser. /// The view's display area. /// - /// Optional. The IShellView interface of the previous view. A Shell view can use this parameter to communicate with a previous view with the same - /// implementation. It can also be used to optimize browsing between like views. + /// Optional. The IShellView interface of the previous view. A Shell view can use this parameter to communicate with a previous + /// view with the same implementation. It can also be used to optimize browsing between like views. /// public SV2CVW2_PARAMS(FOLDERVIEWMODE viewMode, FOLDERFLAGS flags, IShellBrowser owner, ref RECT displayArea, IShellView prevView = null) { @@ -807,8 +1209,8 @@ namespace Vanara.PInvoke } /// - /// A view ID. The view ID can be one of the Windows-defined VIDs or a custom, view-defined VID. This value takes precedence over the view mode - /// designated in the FOLDERSETTINGS structure pointed to by pfs. + /// A view ID. The view ID can be one of the Windows-defined VIDs or a custom, view-defined VID. This value takes precedence over + /// the view mode designated in the FOLDERSETTINGS structure pointed to by pfs. /// public Guid pvid => _pvid.ToStructure(); diff --git a/PInvoke/Shell32/ShObjIdl.IStartMenuPinnedList.cs b/PInvoke/Shell32/ShObjIdl.IStartMenuPinnedList.cs index 59b865cf..3beab649 100644 --- a/PInvoke/Shell32/ShObjIdl.IStartMenuPinnedList.cs +++ b/PInvoke/Shell32/ShObjIdl.IStartMenuPinnedList.cs @@ -5,9 +5,32 @@ namespace Vanara.PInvoke { public static partial class Shell32 { - /// Exposes a method that unpins an application shortcut from the Start menu or the taskbar. + /// + /// Exposes a method that unpins an application shortcut from the Start menu or the taskbar. + /// + /// + /// When to Implement + /// Windows provides an implementation of this interface as CLSID_StartMenuPin. Third parties do not provide their own implementation. + /// When to Use + /// + /// Any shortcut installed by an application might have been subsequently pinned by the user, and there is no way for an application + /// to know this. Therefore, we recommend that, during uninstallation, all applications call IStartMenuPinnedList::RemoveFromList on + /// each shortcut they installed. + /// + /// + /// Note that IStartMenuPinnedList does not remove the shortcuts themselves, it only unpins them. Applications first call + /// IStartMenuPinnedList::RemoveFromList on a shortcut, then delete that shortcut. + /// + /// Compatibility + /// + /// In Windows 8, the Start screen replaces the legacy Start menu. CLSID_StartMenuPin and IStartMenuPinnedList are present in Windows + /// 8 to provide backward compatibility with existing applications, but they do not affect tiles pinned to the Windows 8 Start + /// screen. CLSID_StartMenuPin and IStartMenuPinnedList do continue to impact items pinned to the Windows 8 desktop taskbar. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl/nn-shobjidl-istartmenupinnedlist + [PInvokeData("shobjidl.h", MSDNShortId = "e1f4dbdb-34c0-4bf5-bb8b-a622a81c1617")] [ComImport, Guid("4CD19ADA-25A5-4A32-B3B7-347BEE5BE36B"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CoClass(typeof(StartMenuPin))] - [PInvokeData("shobjidl.h")] public interface IStartMenuPinnedList { /// diff --git a/PInvoke/Shell32/ShellApi.cs b/PInvoke/Shell32/ShellApi.cs index 301558f4..cbb56b02 100644 --- a/PInvoke/Shell32/ShellApi.cs +++ b/PInvoke/Shell32/ShellApi.cs @@ -4,6 +4,7 @@ using System.Runtime.InteropServices; using System.Text; using Vanara.InteropServices; using static Vanara.PInvoke.AdvApi32; +using static Vanara.PInvoke.ComCtl32; using static Vanara.PInvoke.Kernel32; using static Vanara.PInvoke.PropSys;