Added more interfaces for Shell Extensions

pull/10/head
David Hall 2018-07-21 21:57:04 -06:00
parent 778d2883b9
commit 749b5af680
6 changed files with 666 additions and 0 deletions

View File

@ -0,0 +1,200 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace Vanara.PInvoke
{
public static partial class Shell32
{
/// <summary>A value that controls the behavior of the view when in common dialog mode.</summary>
[Flags]
[PInvokeData("Shobjidl.h")]
public enum CDB2GVF
{
/// <summary>All files, including hidden and system files, should be shown. In Windows XP, this is the only recognized flag.</summary>
CDB2GVF_SHOWALLFILES = 0x00000001,
/// <summary>This browser is designated to choose a file to save.</summary>
CDB2GVF_ISFILESAVE = 0x00000002,
/// <summary>Not used.</summary>
CDB2GVF_ALLOWPREVIEWPANE = 0x00000004,
/// <summary>Do not show a "select" verb on an item's context menu.</summary>
CDB2GVF_NOSELECTVERB = 0x00000008,
/// <summary>IncludeObject should not be called.</summary>
CDB2GVF_NOINCLUDEITEM = 0x00000010,
/// <summary>This browser is designated to pick folders.</summary>
CDB2GVF_ISFOLDERPICKER = 0x00000020,
/// <summary>Windows 7 and later. Displays a UAC shield on the selected item when CDB2GVF_NOSELECTVERB is not specified.</summary>
CDB2GVF_ADDSHIELD = 0x00000040,
}
/// <summary>Values for ICommDlgBrowser2::Notify method.</summary>
[PInvokeData("Shobjidl.h")]
public enum CDB2N
{
/// <summary>Indicates that the shortcut menu is no longer displayed.</summary>
CDB2N_CONTEXTMENU_DONE = 0x00000001,
/// <summary>Indicates that the shortcut menu is about to be displayed.</summary>
CDB2N_CONTEXTMENU_START = 0x00000002
}
/// <summary>Indicates a change in the selection state in ICommDlgBrowser::OnStateChange.</summary>
[PInvokeData("Shobjidl.h")]
public enum CDBOSC
{
/// <summary>The focus has been set to the view.</summary>
CDBOSC_SETFOCUS = 0x00000000,
/// <summary>The view has lost the focus.</summary>
CDBOSC_KILLFOCUS = 0x00000001,
/// <summary>The selection has changed.</summary>
CDBOSC_SELCHANGE = 0x00000002,
/// <summary>An item has been renamed.</summary>
CDBOSC_RENAME = 0x00000003,
/// <summary>An item has been checked or unchecked.</summary>
CDBOSC_STATECHANGE = 0x00000004,
}
/// <summary>
/// Exposed by the common file dialog boxes to be used when they host a Shell browser. If supported, ICommDlgBrowser exposes methods
/// that allow a Shell view to handle several cases that require different behavior in a dialog box than in a normal Shell view. You
/// obtain an ICommDlgBrowser interface pointer by calling QueryInterface on the IShellBrowser object.
/// </summary>
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("000214F1-0000-0000-C000-000000000046")]
[PInvokeData("Shobjidl.h", MSDNShortId = "bf89ac6e-6c2e-4944-885c-9ab62f58fe71")]
public interface ICommDlgBrowser
{
/// <summary>Called when a user double-clicks in the view or presses the ENTER key.</summary>
/// <param name="ppshv">A pointer to the view's IShellView interface.</param>
void OnDefaultCommand([In] IShellView ppshv);
/// <summary>Called after a state, identified by the uChange parameter, has changed in the IShellView interface.</summary>
/// <param name="ppshv">A pointer to the view's IShellView interface.</param>
/// <param name="uChange">Change in the selection state. This parameter can be one of the following values.</param>
void OnStateChange([In] IShellView ppshv, CDBOSC uChange);
/// <summary>Allows the common dialog box to filter objects that the view displays.</summary>
/// <param name="ppshv">A pointer to the view's IShellView interface.</param>
/// <param name="pidl">A PIDL, relative to the folder, that identifies the object.</param>
/// <returns>The browser should return S_OK to include the object in the view, or S_FALSE to hide it.</returns>
[PreserveSig]
HRESULT IncludeObject([In] IShellView ppshv, PIDL pidl);
}
/// <summary>
/// Extends the capabilities of ICommDlgBrowser. This interface is exposed by the common file dialog boxes when they host a Shell
/// browser. A pointer to ICommDlgBrowser2 can be obtained by calling QueryInterface on the IShellBrowser object.
/// </summary>
/// <seealso cref="Vanara.PInvoke.Shell32.ICommDlgBrowser"/>
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("10339516-2894-11d2-9039-00C04F8EEB3E")]
[PInvokeData("Shobjidl.h", MSDNShortId = "07a416a2-340d-4308-a6f3-cf6f19f3c906")]
public interface ICommDlgBrowser2 : ICommDlgBrowser
{
/// <summary>Called when a user double-clicks in the view or presses the ENTER key.</summary>
/// <param name="ppshv">A pointer to the view's IShellView interface.</param>
new void OnDefaultCommand([In] IShellView ppshv);
/// <summary>Called after a state, identified by the uChange parameter, has changed in the IShellView interface.</summary>
/// <param name="ppshv">A pointer to the view's IShellView interface.</param>
/// <param name="uChange">Change in the selection state. This parameter can be one of the following values.</param>
new void OnStateChange([In] IShellView ppshv, CDBOSC uChange);
/// <summary>Allows the common dialog box to filter objects that the view displays.</summary>
/// <param name="ppshv">A pointer to the view's IShellView interface.</param>
/// <param name="pidl">A PIDL, relative to the folder, that identifies the object.</param>
/// <returns>The browser should return S_OK to include the object in the view, or S_FALSE to hide it.</returns>
[PreserveSig]
new HRESULT IncludeObject([In] IShellView ppshv, PIDL pidl);
/// <summary>Called by a Shell view to notify the common dialog box hosting it that an event has occurred.</summary>
/// <param name="ppshv">A pointer to the view's IShellView interface.</param>
/// <param name="dwNotifyType">A flag that can can take one of the following two values.</param>
void Notify([In] IShellView ppshv, CDB2N dwNotifyType);
/// <summary>Called by the Shell view to get the default shortcut menu text.</summary>
/// <param name="ppshv">A pointer to the view's IShellView interface.</param>
/// <param name="pszText">A pointer to a buffer that is used by the Shell browser to return the default shortcut menu text.</param>
/// <param name="cchMax">
/// The size of the pszText buffer, in characters. It should be at least the maximum allowable path length (MAX_PATH) in size.
/// </param>
/// <returns>
/// Returns S_OK if a new default shortcut menu text was returned in pshv. If S_FALSE is returned, use the normal default text.
/// Otherwise, returns a standard COM error value.
/// </returns>
[PreserveSig]
HRESULT GetDefaultMenuText([In] IShellView ppshv, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszText, int cchMax);
/// <summary>Called when the view must determine if special customization needs to be made for the common dialog browser.</summary>
/// <returns>A DWORD value that controls the behavior of the view when in common dialog mode.</returns>
CDB2GVF GetViewFlags();
}
/// <summary>Extends the capabilities of ICommDlgBrowser2, and used by the common file dialog boxes when they host a Shell browser.</summary>
/// <seealso cref="Vanara.PInvoke.Shell32.ICommDlgBrowser"/>
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("c8ad25a1-3294-41ee-8165-71174bd01c57")]
[PInvokeData("Shobjidl.h", MSDNShortId = "c9286061-8ac8-452b-9204-193bc6b571cb")]
public interface ICommDlgBrowser3 : ICommDlgBrowser2
{
/// <summary>Called when a user double-clicks in the view or presses the ENTER key.</summary>
/// <param name="ppshv">A pointer to the view's IShellView interface.</param>
new void OnDefaultCommand([In] IShellView ppshv);
/// <summary>Called after a state, identified by the uChange parameter, has changed in the IShellView interface.</summary>
/// <param name="ppshv">A pointer to the view's IShellView interface.</param>
/// <param name="uChange">Change in the selection state. This parameter can be one of the following values.</param>
new void OnStateChange([In] IShellView ppshv, CDBOSC uChange);
/// <summary>Allows the common dialog box to filter objects that the view displays.</summary>
/// <param name="ppshv">A pointer to the view's IShellView interface.</param>
/// <param name="pidl">A PIDL, relative to the folder, that identifies the object.</param>
/// <returns>The browser should return S_OK to include the object in the view, or S_FALSE to hide it.</returns>
[PreserveSig]
new HRESULT IncludeObject([In] IShellView ppshv, PIDL pidl);
/// <summary>Called by a Shell view to notify the common dialog box hosting it that an event has occurred.</summary>
/// <param name="ppshv">A pointer to the view's IShellView interface.</param>
/// <param name="dwNotifyType">A flag that can can take one of the following two values.</param>
new void Notify([In] IShellView ppshv, CDB2N dwNotifyType);
/// <summary>Called by the Shell view to get the default shortcut menu text.</summary>
/// <param name="ppshv">A pointer to the view's IShellView interface.</param>
/// <param name="pszText">A pointer to a buffer that is used by the Shell browser to return the default shortcut menu text.</param>
/// <param name="cchMax">
/// The size of the pszText buffer, in characters. It should be at least the maximum allowable path length (MAX_PATH) in size.
/// </param>
/// <returns>
/// Returns S_OK if a new default shortcut menu text was returned in pshv. If S_FALSE is returned, use the normal default text.
/// Otherwise, returns a standard COM error value.
/// </returns>
[PreserveSig]
new HRESULT GetDefaultMenuText([In] IShellView ppshv, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszText, int cchMax);
/// <summary>Called when the view must determine if special customization needs to be made for the common dialog browser.</summary>
/// <returns>A DWORD value that controls the behavior of the view when in common dialog mode.</returns>
new CDB2GVF GetViewFlags();
/// <summary>Called after a specified column is clicked in the IShellView interface.</summary>
/// <param name="ppshv">A pointer to the IShellView interface of the hosted view.</param>
/// <param name="iColumn">The index of the column clicked.</param>
void OnColumnClicked([In] IShellView ppshv, int iColumn);
/// <summary>Gets the current filter as a Unicode string.</summary>
/// <param name="pszFileSpec">Contains a pointer to the current filter path/file as a Unicode string.</param>
/// <param name="cchFileSpec">Specifies the path/file length, in characters.</param>
void GetCurrentFilter([MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFileSpec, int cchFileSpec);
/// <summary>Called after a specified preview is created in the IShellView interface.</summary>
/// <param name="ppshv">A pointer to the IShellView interface of the hosted view.</param>
void OnPreViewCreated([In] IShellView ppshv);
}
}
}

View File

@ -0,0 +1,196 @@
using System;
using System.Runtime.InteropServices;
namespace Vanara.PInvoke
{
public static partial class Shell32
{
/// <summary>These flags are used with IExplorerBrowser::GetOptions and IExplorerBrowser::SetOptions.</summary>
[Flags]
[PInvokeData("Shobjidl.h", MSDNShortId = "4e2983bc-cad2-4bcc-8169-57b5274b2142")]
public enum EXPLORER_BROWSER_OPTIONS
{
/// <summary>No options.</summary>
EBO_NONE = 0x00000000,
/// <summary>Do not navigate further than the initial navigation.</summary>
EBO_NAVIGATEONCE = 0x00000001,
/// <summary>
/// Use the following standard panes: Commands Module pane, Navigation pane, Details pane, and Preview pane. An implementer of
/// IExplorerPaneVisibility can modify the components of the Commands Module that are shown. For more information see,
/// IExplorerPaneVisibility::GetPaneState. If EBO_SHOWFRAMES is not set, Explorer browser uses a single view object.
/// </summary>
EBO_SHOWFRAMES = 0X00000002,
/// <summary>Always navigate, even if you are attempting to navigate to the current folder.</summary>
EBO_ALWAYSNAVIGATE = 0x00000004,
/// <summary>Do not update the travel log.</summary>
EBO_NOTRAVELLOG = 0x00000008,
/// <summary>
/// Do not use a wrapper window. This flag is used with legacy clients that need the browser parented directly on themselves.
/// </summary>
EBO_NOWRAPPERWINDOW = 0x00000010,
/// <summary>Show WebView for sharepoint sites.</summary>
EBO_HTMLSHAREPOINTVIEW = 0x00000020,
/// <summary>Introduced in Windows Vista. Do not draw a border around the browser window.</summary>
EBO_NOBORDER = 0x00000040,
/// <summary>Introduced in Windows Vista. Do not persist the view state.</summary>
EBO_NOPERSISTVIEWSTATE = 0x00000080,
}
/// <summary>These flags are used with IExplorerBrowser::FillFromObject.</summary>
[Flags]
[PInvokeData("Shobjidl.h", MSDNShortId = "5be62600-147d-4625-8e6c-aa6687da2168")]
public enum EXPLORER_BROWSER_FILL_FLAGS
{
/// <summary>No flags.</summary>
EBF_NONE = 0x0000000,
/// <summary>
/// Causes IExplorerBrowser::FillFromObject to first populate the results folder with the contents of the parent folders of the
/// items in the data object, and then select only the items that are in the data object.
/// </summary>
EBF_SELECTFROMDATAOBJECT = 0x0000100,
/// <summary>
/// Do not allow dropping on the folder. In other words, do not register a drop target for the view. Applications can then
/// register their own drop targets.
/// </summary>
EBF_NODROPTARGET = 0x0000200,
}
/// <summary>
/// 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.
/// <para>
/// 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.
/// </para>
/// </summary>
[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
{
/// <summary>Prepares the browser to be navigated.</summary>
/// <param name="hwndParent">A handle to the owner window or control.</param>
/// <param name="prc">
/// A pointer to a RECT that contains the coordinates of the bounding rectangle that the browser will occupy. The coordinates are
/// relative to hwndParent.
/// </param>
/// <param name="pfs">A pointer to a FOLDERSETTINGS structure that determines how the folder will be displayed in the view.</param>
void Initialize([In] HandleRef hwndParent, [In, MarshalAs(UnmanagedType.LPStruct)] RECT prc, [In, MarshalAs(UnmanagedType.LPStruct)] FOLDERSETTINGS pfs);
/// <summary>Destroys the browser.</summary>
void Destroy();
/// <summary>Sets the size and position of the view windows created by the browser.</summary>
/// <param name="phdwp">A pointer to a DeferWindowPos handle. This parameter can be NULL.</param>
/// <param name="rcBrowser">The coordinates that the browser will occupy.</param>
void SetRect(IntPtr phdwp, RECT rcBrowser);
/// <summary>Sets the name of the property bag.</summary>
/// <param name="pszPropertyBag">
/// A pointer to a constant, null-terminated, Unicode string that contains the name of the property bag. View state information
/// that is specific to the application of the client is stored (persisted) using this name.
/// </param>
void SetPropertyBag([In, MarshalAs(UnmanagedType.LPWStr)] string pszPropertyBag);
/// <summary>Sets the default empty text.</summary>
/// <param name="pszEmptyText">A pointer to a constant, null-terminated, Unicode string that contains the empty text.</param>
void SetEmptyText([In, MarshalAs(UnmanagedType.LPWStr)] string pszEmptyText);
/// <summary>Sets the folder settings for the current view.</summary>
/// <param name="pfs">A pointer to a FOLDERSETTINGS structure that contains the folder settings to be applied.</param>
void SetFolderSettings([In, MarshalAs(UnmanagedType.LPStruct)] FOLDERSETTINGS pfs);
/// <summary>Initiates a connection with IExplorerBrowser for event callbacks.</summary>
/// <param name="psbe">A pointer to the IExplorerBrowserEvents interface of the object to be advised of IExplorerBrowser events.</param>
/// <param name="pdwCookie">
/// When this method returns, contains a token that uniquely identifies the event listener. This allows several event listeners
/// to be subscribed at a time.
/// </param>
void Advise([In] IExplorerBrowserEvents psbe, out uint pdwCookie);
/// <summary>Terminates an advisory connection.</summary>
/// <param name="dwCookie">
/// A connection token previously returned from IExplorerBrowser::Advise. Identifies the connection to be terminated.
/// </param>
void Unadvise([In] uint dwCookie);
/// <summary>Sets the current browser options.</summary>
/// <param name="dwFlag">One or more EXPLORER_BROWSER_OPTIONS flags to be set.</param>
void SetOptions([In] EXPLORER_BROWSER_OPTIONS dwFlag);
/// <summary>Gets the current browser options.</summary>
/// <returns>When this method returns, contains the current EXPLORER_BROWSER_OPTIONS for the browser.</returns>
EXPLORER_BROWSER_OPTIONS GetOptions();
/// <summary>Browses to a pointer to an item identifier list (PIDL)</summary>
/// <param name="pidl">
/// A pointer to a const ITEMIDLIST (item identifier list) that specifies an object's location as the destination to navigate to.
/// This parameter can be NULL. For more information, see Remarks.
/// </param>
/// <param name="uFlags">A flag that specifies the category of the pidl. This affects how navigation is accomplished.</param>
void BrowseToIDList([In] PIDL pidl, [In] SBSP uFlags);
/// <summary>Browses to an object.</summary>
/// <param name="punk">A pointer to an object to browse to. If the object cannot be browsed, an error value is returned.</param>
/// <param name="uFlags">A flag that specifies the category of the pidl. This affects how navigation is accomplished.</param>
void BrowseToObject([In, MarshalAs(UnmanagedType.IUnknown)] object punk, [In] SBSP uFlags);
/// <summary>Creates a results folder and fills it with items.</summary>
/// <param name="punk">
/// An interface pointer on the source object that will fill the IResultsFolder. This can be an IDataObject or any object that
/// can be used with INamespaceWalk.
/// </param>
/// <param name="dwFlags">One of the EXPLORER_BROWSER_FILL_FLAGS values.</param>
void FillFromObject([In, MarshalAs(UnmanagedType.IUnknown)] object punk, [In] EXPLORER_BROWSER_FILL_FLAGS dwFlags);
/// <summary>Removes all items from the results folder.</summary>
void RemoveAll();
/// <summary>Gets an interface for the current view of the browser.</summary>
/// <param name="riid">A reference to the desired interface ID.</param>
/// <returns>
/// When this method returns, contains the interface pointer requested in riid. This will typically be IShellView, IShellView2,
/// IFolderView, or a related interface.
/// </returns>
[return: MarshalAs(UnmanagedType.IUnknown)]
object GetCurrentView([In, MarshalAs(UnmanagedType.LPStruct)] Guid riid);
}
/// <summary>Exposes methods for notification of Explorer browser navigation and view creation events.</summary>
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("361bbdc7-e6ee-4e13-be58-58e2240c810f"), CoClass(typeof(ExplorerBrowser))]
[PInvokeData("Shobjidl.h", MSDNShortId = "802d547f-41c2-4c4a-9f07-be615d7b86eb")]
public interface IExplorerBrowserEvents
{
/// <summary>Notifies clients of a pending Explorer browser navigation to a Shell folder.</summary>
/// <param name="pidlFolder">A PIDL that specifies the folder.</param>
void OnNavigationPending([In] PIDL pidlFolder);
/// <summary>Notifies clients that the view of the Explorer browser has been created and can be modified.</summary>
/// <param name="psv">A pointer to an IShellView.</param>
void OnViewCreated([In] IShellView psv);
/// <summary>Notifies clients that the Explorer browser has successfully navigated to a Shell folder.</summary>
/// <param name="pidlFolder">A PIDL that specifies the folder.</param>
void OnNavigationComplete([In] PIDL pidlFolder);
/// <summary>Notifies clients that the Explorer browser has failed to navigate to a Shell folder.</summary>
/// <param name="pidlFolder">A PIDL that specifies the folder.</param>
void OnNavigationFailed([In] PIDL pidlFolder);
}
/// <summary>The ExplorerBrowser class is the base CoClass for all I ExplorerBrowser interfaces.</summary>
[ComImport, Guid("71f96385-ddd6-48d3-a0c1-ae06e8b055fb"), ClassInterface(ClassInterfaceType.None)]
[PInvokeData("Shobjidl.h", MSDNShortId = "da2cf5d4-5a68-4d18-807b-b9d4e2712c10")]
public class ExplorerBrowser { }
}
}

View File

@ -0,0 +1,101 @@
using System;
using System.Runtime.InteropServices;
namespace Vanara.PInvoke
{
public static partial class Shell32
{
/// <summary>
/// Indicate flags used by IExplorerPaneVisibility::GetPaneState to get the current state of the given Windows Explorer pane.
/// </summary>
[Flags]
[PInvokeData("Shobjidl.h", MSDNShortId = "4caa2fe7-5bb3-4940-a429-fd32128eea84")]
public enum EXPLORERPANESTATE
{
/// <summary>Do not make any modifications to the pane.</summary>
EPS_DONTCARE = 0x0000,
/// <summary>Set the default state of the pane to "on", but respect any user-modified persisted state.</summary>
EPS_DEFAULT_ON = 0x0001,
/// <summary>Set the default state of the pane to "off".</summary>
EPS_DEFAULT_OFF = 0x0002,
/// <summary>Unused.</summary>
EPS_STATEMASK = 0xFFFF,
/// <summary>Ignore any persisted state from the user, but the user can still modify the state.</summary>
EPS_INITIALSTATE = 0x00010000,
/// <summary>
/// Users cannot modify the state, that is, they do not have the ability to show or hide the given pane. This option implies EPS_INITIALSTATE.
/// </summary>
EPS_FORCE = 0x00020000,
}
/// <summary>
/// Used in Windows Explorer by an IShellFolder implementation to give suggestions to the view about what panes are visible.
/// Additionally, an IExplorerBrowser host can use this interface to provide information about pane visibility. The host should
/// implement QueryService with SID_ExplorerPaneVisibility as the service ID. The host must be in the site chain.
/// <para>
/// The IExplorerPaneVisibility implementation is retrieved from the Shell folder.The Shell folder, in turn, is retrieved from the
/// view.A namespace extension can elect to provide a custom view(IShellView) rather than using the system folder view object
/// (DefView). In that case, the IShellView implementation must include an implementation of IFolderView::GetFolder to return the
/// IExplorerPaneVisibility object.
/// </para>
/// <para>
/// A namespace extension can provide a custom view by implementing IShellView itself rather than using the system folder view object
/// (DefView). In that case, the IShellView implementation must include an implementation of IFolderView::GetFolder to make use of IExplorerPaneVisibility.
/// </para>
/// </summary>
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("e07010ec-bc17-44c0-97b0-46c7c95b9edc")]
[PInvokeData("Shobjidl.h", MSDNShortId = "b940adc2-dfef-49c5-b86c-d0da83db0aad")]
public interface IExplorerPaneVisibility
{
/// <summary>Gets the visibility state of the given Windows Explorer pane.</summary>
/// <param name="ep">
/// A reference to a GUID that uniquely identifies a Windows Explorer pane. One of the constants as defined in Shlguid.h.
/// </param>
/// <returns>
/// When this method returns, contains the visibility state of the given Windows Explorer pane as one of the EXPLORERPANESTATE constants.
/// </returns>
EXPLORERPANESTATE GetPaneState([In, MarshalAs(UnmanagedType.LPStruct)] Guid ep);
}
/// <summary>Constant GUIDs used by IExplorerPaneVisibility::GetPaneState.</summary>
public static class IExplorerPaneVisibilityConstants
{
/// <summary>Additional fields and options to aid in a search.</summary>
public readonly static Guid EP_AdvQueryPane = new Guid("{b4e9db8b-34ba-4c39-b5cc-16a1bd2c411c}");
/// <summary>Commands module along the top of the Windows Explorer window.</summary>
public readonly static Guid EP_Commands = new Guid("{d9745868-ca5f-4a76-91cd-f5a129fbb076}");
/// <summary>Organize menu within the commands module.</summary>
public readonly static Guid EP_Commands_Organize = new Guid("{72e81700-e3ec-4660-bf24-3c3b7b648806}");
/// <summary>View menu within the commands module.</summary>
public readonly static Guid EP_Commands_View = new Guid("{21f7c32d-eeaa-439b-bb51-37b96fd6a943}");
/// <summary>Pane showing metadata along the bottom of the Windows Explorer window.</summary>
public readonly static Guid EP_DetailsPane = new Guid("{43abf98b-89b8-472d-b9ce-e69b8229f019}");
/// <summary>The pane on the left side of the Windows Explorer window that hosts the folders tree and Favorites.</summary>
public readonly static Guid EP_NavPane = new Guid("{cb316b22-25f7-42b8-8a09-540d23a43c2f}");
/// <summary>Pane on the right of the Windows Explorer window that shows a large reading preview of the file.</summary>
public readonly static Guid EP_PreviewPane = new Guid("{893c63d1-45c8-4d17-be19-223be71be365}");
/// <summary>Quick filter buttons to aid in a search.</summary>
public readonly static Guid EP_QueryPane = new Guid("{65bcde4f-4f07-4f27-83a7-1afca4df7ddd}");
/// <summary>
/// Introduced in Windows 8: The ribbon, which is the control that replaced menus and toolbars at the top of many Microsoft applications.
/// </summary>
public readonly static Guid EP_Ribbon = new Guid("{D27524A8-C9F2-4834-A106-DF8889FD4F37}");
/// <summary>Introduced in Windows 8: A status bar that indicates the progress of some process, such as copying or downloading.</summary>
public readonly static Guid EP_StatusBar = new Guid("{65fe56ce-5cfe-4bc4-ad8a-7ae3fe7e8f7c}");
}
}
}

View File

@ -0,0 +1,111 @@
using System;
using System.Runtime.InteropServices;
namespace Vanara.PInvoke
{
public static partial class Shell32
{
/// <summary>Exposes methods for the display of rich previews.</summary>
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("8895b1c6-b41f-4c1c-a562-0d564250836f")]
[PInvokeData("Shobjidl.h")]
public interface IPreviewHandler
{
/// <summary>
/// Sets the parent window of the previewer window, as well as the area within the parent to be used for the previewer window.
/// </summary>
/// <param name="hwnd">A handle to the parent window.</param>
/// <param name="prc">A pointer to a RECT defining the area for the previewer.</param>
void SetWindow([In] HandleRef hwnd, [In, MarshalAs(UnmanagedType.LPStruct)] RECT prc);
/// <summary>Directs the preview handler to change the area within the parent hwnd that it draws into.</summary>
/// <param name="prc">A pointer to a RECT to be used for the preview.</param>
void SetRect([In, MarshalAs(UnmanagedType.LPStruct)] RECT prc);
/// <summary>
/// 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.
/// </summary>
void DoPreview();
/// <summary>
/// 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.
/// </summary>
void Unload();
/// <summary>Directs the preview handler to set focus to itself.</summary>
void SetFocus();
/// <summary>Directs the preview handler to return the HWND from calling the GetFocus Function.</summary>
/// <returns>
/// When this method returns, contains a pointer to the HWND returned from calling the GetFocus Function from the preview
/// handler's foreground thread.
/// </returns>
IntPtr QueryFocus();
/// <summary>
/// Directs the preview handler to handle a keystroke passed up from the message pump of the process in which the preview handler
/// is running.
/// </summary>
/// <param name="pmsg">A pointer to a window message.</param>
/// <returns>
/// If the keyboard shortcut is one that the host intends to handle, the host will process it and return S_OK; otherwise, it
/// returns S_FALSE.
/// </returns>
[PreserveSig]
HRESULT TranslateAccelerator([In, MarshalAs(UnmanagedType.LPStruct)] MSG pmsg);
}
/// <summary>
/// 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.
/// </summary>
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("fec87aaf-35f9-447a-adb7-20234491401a")]
[PInvokeData("Shobjidl.h")]
public interface IPreviewHandlerFrame
{
/// <summary>Gets a list of the keyboard shortcuts for the preview host.</summary>
/// <returns>A pointer to a PREVIEWHANDLERFRAMEINFO structure that receives accelerator table information.</returns>
PREVIEWHANDLERFRAMEINFO GetWindowContext();
/// <summary>Directs the host to handle an keyboard shortcut passed from the preview handler.</summary>
/// <param name="pmsg">A pointer to a WM_COMMAND or WM_SYSCOMMAND window message that corresponds to a keyboard shortcut.</param>
/// <returns>
/// If the keyboard shortcut is one that the host intends to handle, the host will process it and return S_OK; otherwise, it
/// returns S_FALSE.
/// </returns>
[PreserveSig]
HRESULT TranslateAccelerator([In, MarshalAs(UnmanagedType.LPStruct)] MSG pmsg);
}
/// <summary>Exposes methods for applying color and font information to preview handlers.</summary>
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("196bf9a5-b346-4ef0-aa1e-5dcdb76768b1")]
[PInvokeData("Shobjidl.h")]
public interface IPreviewHandlerVisuals
{
/// <summary>Sets the background color of the preview handler.</summary>
/// <param name="color">A value of type COLORREF to use for the preview handler background.</param>
void SetBackgroundColor(COLORREF color);
/// <summary>Sets the font attributes to be used for text within the preview handler.</summary>
/// <param name="plf">A pointer to a LOGFONTW Structure containing the necessary attributes for the font to use.</param>
void SetFont([In, MarshalAs(UnmanagedType.LPStruct)] LOGFONT plf);
/// <summary>Sets the color of the text within the preview handler.</summary>
/// <param name="color">A value of type COLORREF to use for the preview handler text color.</param>
void SetTextColor(COLORREF color);
}
/// <summary>Accelerator table structure. Used by IPreviewHandlerFrame::GetWindowContext.</summary>
[StructLayout(LayoutKind.Sequential)]
[PInvokeData("Shobjidl.h")]
public struct PREVIEWHANDLERFRAMEINFO
{
/// <summary>A handle to the accelerator table.</summary>
public IntPtr haccel;
/// <summary>The number of entries in the accelerator table.</summary>
public uint cAccelEntries;
}
}
}

View File

@ -0,0 +1,21 @@
using System;
using System.Runtime.InteropServices;
namespace Vanara.PInvoke
{
public static partial class Shell32
{
/// <summary>Defines a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</summary>
[ComImport, Guid("6d5140c1-7436-11ce-8034-00aa006009fa"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[PInvokeData("servprov.h")]
public interface IServiceProvider
{
/// <summary>Performs as a factory for services that are exposed through an implementation of IServiceProvider.</summary>
/// <param name="guidService">A unique identifier of the requested service.</param>
/// <param name="riid">A unique identifier of the interface which the caller wishes to receive for the service.</param>
/// <returns>The interface specified by the riid parameter.</returns>
[return: MarshalAs(UnmanagedType.IUnknown)]
object QueryService([In, MarshalAs(UnmanagedType.LPStruct)] Guid guidService, [In, MarshalAs(UnmanagedType.LPStruct)] Guid riid);
};
}
}

View File

@ -408,6 +408,43 @@ namespace Vanara.PInvoke
SafeCoTaskMemString GetProgID();
}
/// <summary>
/// Provides a simple way to support communication between an object and its site in the container.
/// <para>
/// Often an object needs to communicate directly with a container site object and, in effect, manage the site object itself.Outside
/// of IOleObject::SetClientSite, there is no generic means through which an object becomes aware of its site. IObjectWithSite
/// provides simple objects with a simple siting mechanism (lighter than IOleObject) This interface should only be used when
/// IOleObject is not already in use.
/// </para>
/// <para>
/// Through IObjectWithSite, a container can pass the IUnknown pointer of its site to the object through
/// IObjectWithSite::SetSite.Callers can also retrieve the latest site passed to SetSite through IObjectWithSite::GetSite.This latter
/// method is included as a hooking mechanism, allowing a third party to intercept calls from the object to the site.
/// </para>
/// </summary>
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("fc4801a3-2ba9-11cf-a229-00aa003d7352")]
[PInvokeData("ocidl.h")]
public interface IObjectWithSite
{
/// <summary>Enables a container to pass an object a pointer to the interface for its site.</summary>
/// <param name="pUnkSite">
/// A pointer to the IUnknown interface pointer of the site managing this object. If NULL, the object should call Release on any
/// existing site at which point the object no longer knows its site.
/// </param>
void SetSite([In, MarshalAs(UnmanagedType.IUnknown)] object pUnkSite);
/// <summary>Retrieves the latest site passed using SetSite.</summary>
/// <param name="riid">The IID of the interface pointer that should be returned in ppvSite.</param>
/// <returns>
/// Address of pointer variable that receives the interface pointer requested in riid. Upon successful return, *ppvSite contains
/// the requested interface pointer to the site last seen in SetSite. The specific interface returned depends on the riid
/// argument in essence, the two arguments act identically to those in QueryInterface. If the appropriate interface pointer is
/// available, the object must call AddRef on that pointer before returning successfully. If no site is available, or the
/// requested interface is not supported, this method must *ppvSite to NULL and return a failure code.
/// </returns>
[return: MarshalAs(UnmanagedType.IUnknown)]
object GetSite([In, MarshalAs(UnmanagedType.LPStruct)] Guid riid);
}
/// <summary>
/// Exposes methods that the Shell uses to retrieve flags and info tip information for an item that resides in an IShellFolder implementation. Info tips
/// are usually displayed inside a tooltip control.