Added documentation and corrected interfaces that are to be implemented by clients so they have PreserveSig.

pull/10/head
David Hall 2018-07-30 15:54:24 -06:00
parent d48759b7c9
commit 46176b22fd
13 changed files with 851 additions and 179 deletions

View File

@ -34,7 +34,7 @@ namespace Vanara.PInvoke
/// </summary>
EBO_NOWRAPPERWINDOW = 0x00000010,
/// <summary>Show WebView for sharepoint sites.</summary>
/// <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>
@ -66,15 +66,96 @@ namespace Vanara.PInvoke
}
/// <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.
/// <c>IExplorerBrowser</c> 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>
/// <para>
/// The Shell provides a default implementation of <c>IExplorerBrowser</c> as CLSID_ExplorerBrowser. Typically, a developer does not
/// need to provide a custom implementation of this interface.
/// </para>
/// <para>
/// The Windows Software Development Kit (SDK) provides full samples that demonstrate the use of and interaction with
/// <c>IExplorerBrowser</c>. Download the Explorer Browser Search Sample and the Explorer Browser Custom Contents Sample.
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// For example code that shows typical use of <c>IExplorerBrowser</c> and its methods, see the Explorer Browser Custom Contents and
/// Explorer Browser Custom Contents samples.
/// </para>
/// <para>
/// 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 <c>Initialize</c>.
/// </para>
/// <para>
/// 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.
/// </para>
/// <para>
/// 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:
/// </para>
/// <list type="bullet">
/// <item>EP_NavPane</item>
/// <item>EP_Commands</item>
/// <item>EP_Commands_Organize</item>
/// <item>EP_Commands_View</item>
/// <item>EP_DetailsPane</item>
/// <item>EP_PreviewPane</item>
/// <item>EP_QueryPane</item>
/// <item>EP_AdvQueryPane</item>
/// <item>EP_StatusBar</item>
/// <item>EP_Ribbon</item>
/// </list>
/// <para>See IExplorerPaneVisibility::GetPaneState for more information.</para>
/// <para>
/// 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
/// <c>ICommDlgBrowser</c> 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.
/// </para>
/// <para>
/// 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.
/// </para>
/// <para>
/// 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 <c>IShellFolder</c> 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 <c>IShellFolder</c> to get any additional information it needs, such as specific properties of the items or the context menu
/// entries for the item.
/// </para>
/// <para>
/// 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 <c>IShellView</c>. 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.
/// </para>
/// <para>
/// <c>Windows 7 and later</c>. 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.
/// </para>
/// </remarks>
// 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
{
/// <summary>Prepares the browser to be navigated.</summary>

View File

@ -52,14 +52,56 @@ namespace Vanara.PInvoke
[PInvokeData("Shobjidl.h", MSDNShortId = "b940adc2-dfef-49c5-b86c-d0da83db0aad")]
public interface IExplorerPaneVisibility
{
/// <summary>Gets the visibility state of the given Windows Explorer pane.</summary>
/// <summary>
/// <para>Gets the visibility state of the given Windows Explorer pane.</para>
/// </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.
/// <para>Type: <c>REFEXPLORERPANE</c></para>
/// <para>
/// A reference to a GUID that uniquely identifies a Windows Explorer pane. One of the following constants as defined in Shlguid.h.
/// </para>
/// <para>EP_NavPane (cb316b22-25f7-42b8-8a09-540d23a43c2f)</para>
/// <para>The pane on the left side of the Windows Explorer window that hosts the folders tree and <c>Favorites</c>.</para>
/// <para>EP_Commands (d9745868-ca5f-4a76-91cd-f5a129fbb076)</para>
/// <para><c>Commands</c> module along the top of the Windows Explorer window.</para>
/// <para>EP_Commands_Organize (72e81700-e3ec-4660-bf24-3c3b7b648806)</para>
/// <para><c>Organize</c> menu within the commands module.</para>
/// <para>EP_Commands_View (21f7c32d-eeaa-439b-bb51-37b96fd6a943)</para>
/// <para><c>View</c> menu within the commands module.</para>
/// <para>EP_DetailsPane (43abf98b-89b8-472d-b9ce-e69b8229f019)</para>
/// <para>Pane showing metadata along the bottom of the Windows Explorer window.</para>
/// <para>EP_PreviewPane (893c63d1-45c8-4d17-be19-223be71be365)</para>
/// <para>Pane on the right of the Windows Explorer window that shows a large reading preview of the file.</para>
/// <para>EP_QueryPane (65bcde4f-4f07-4f27-83a7-1afca4df7ddd)</para>
/// <para>Quick filter buttons to aid in a search.</para>
/// <para>EP_AdvQueryPane (b4e9db8b-34ba-4c39-b5cc-16a1bd2c411c)</para>
/// <para>Additional fields and options to aid in a search.</para>
/// <para>EP_StatusBar (65fe56ce-5cfe-4bc4-ad8a-7ae3fe7e8f7c)</para>
/// <para><c>Introduced in Windows 8</c>: A status bar that indicates the progress of some process, such as copying or downloading.</para>
/// <para>EP_Ribbon (d27524a8-c9f2-4834-a106-df8889fd4f37)</para>
/// <para>
/// <c>Introduced in Windows 8</c>: The ribbon, which is the control that replaced menus and toolbars at the top of many
/// Microsoft applications.
/// </para>
/// </param>
/// <param name="peps">
/// <para>Type: <c>EXPLORERPANESTATE*</c></para>
/// <para>
/// When this method returns, contains the visibility state of the given Windows Explorer pane as one of the EXPLORERPANESTATE constants.
/// </para>
/// </param>
/// <returns>
/// When this method returns, contains the visibility state of the given Windows Explorer pane as one of the EXPLORERPANESTATE constants.
/// <para>Type: <c>HRESULT</c></para>
/// <para>If this method succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</para>
/// </returns>
EXPLORERPANESTATE GetPaneState([In, MarshalAs(UnmanagedType.LPStruct)] Guid ep);
/// <remarks>
/// 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.
/// </remarks>
[PInvokeData("shobjidl_core.h", MSDNShortId = "6c051cdc-b7f9-48dc-ba32-38f0f1ee5fda")]
[PreserveSig]
HRESULT GetPaneState([In, MarshalAs(UnmanagedType.LPStruct)] Guid ep, ref EXPLORERPANESTATE peps);
}
/// <summary>Constant GUIDs used by IExplorerPaneVisibility::GetPaneState.</summary>

View File

@ -5,16 +5,51 @@ namespace Vanara.PInvoke
{
public static partial class Shell32
{
/// <summary>Exposes a method to initialize a handler, such as a property handler, thumbnail handler, or preview handler, with a file path.</summary>
/// <summary>
/// Exposes a method to initialize a handler, such as a property handler, thumbnail handler, or preview handler, with a file path.
/// </summary>
/// <remarks>
/// Whenever possible, it is recommended that initialization be done through a stream using IInitializeWithStream. Benefits of this
/// include increased security and stability.
/// </remarks>
// 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
{
/// <summary>
/// Initializes a handler with a file path.
/// <para>Initializes a handler with a file path.</para>
/// </summary>
/// <param name="pszFilePath">A pointer to a buffer that contains the file path as a null-terminated Unicode string.</param>
/// <param name="grfMode">One of the following STGM values that indicates the access mode for pszFilePath.</param>
void Initialize([In, MarshalAs(UnmanagedType.LPWStr)] string pszFilePath, STGM grfMode);
/// <param name="pszFilePath">
/// <para>Type: <c>LPCWSTR</c></para>
/// <para>A pointer to a buffer that contains the file path as a null-terminated Unicode string.</para>
/// </param>
/// <param name="grfMode">
/// <para>Type: <c>DWORD</c></para>
/// <para>One of the following STGM values that indicates the access mode for .</para>
/// <para>STGM_READ</para>
/// <para>The file indicated by <c>IInitializeWithFile::Initialize</c> is read-only.</para>
/// <para>STGM_READWRITE</para>
/// <para>The file indicated by <c>IInitializeWithFile::Initialize</c> can be read from and written to.</para>
/// </param>
/// <returns>
/// <para>Type: <c>HRESULT</c></para>
/// <para>If this method succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</para>
/// </returns>
/// <remarks>
/// <para>
/// 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 <c>IInitializeWithFile::Initialize</c> only when
/// the API used by the handler to access the file accepts file paths only.
/// </para>
/// <para>The file pointed to by must remain open for the lifetime of the handler or until IPropertyStore::Commit is called.</para>
/// <para>If the file cannot be opened according to the method's parameter values, this method returns a suitable error code.</para>
/// <para>
/// 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 .
/// </para>
/// </remarks>
HRESULT Initialize([In, MarshalAs(UnmanagedType.LPWStr)] string pszFilePath, STGM grfMode);
}
}
}

View File

@ -5,14 +5,29 @@ namespace Vanara.PInvoke
{
public static partial class Shell32
{
/// <summary>Exposes a method used to initialize a handler, such as a property handler, thumbnail handler, or preview handler, with an IShellItem.</summary>
/// <summary>
/// Exposes a method used to initialize a handler, such as a property handler, thumbnail handler, or preview handler, with an <c>IShellItem</c>.
/// </summary>
// 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
{
/// <summary>Initializes a handler with an IShellItem.</summary>
/// <param name="psi">A pointer to an IShellItem.</param>
/// <param name="grfMode">One of the following STGM values that indicate the access mode for psi..</param>
void Initialize(IShellItem psi, STGM grfMode);
/// <summary>Initializes a handler with an <c>IShellItem</c>.</summary>
/// <param name="psi">
/// <para>Type: <c><c>IShellItem</c>*</c></para>
/// <para>A pointer to an <c>IShellItem</c>.</para>
/// </param>
/// <param name="grfMode">
/// <para>Type: <c>DWORD</c></para>
/// <para>One of the following <c>STGM</c> values that indicate the access mode for psi.</para>
/// </param>
/// <returns>
/// <para>Type: <c>HRESULT</c></para>
/// <para>If this method succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</para>
/// </returns>
[PreserveSig]
HRESULT Initialize(IShellItem psi, STGM grfMode);
}
}
}

View File

@ -6,14 +6,52 @@ namespace Vanara.PInvoke
{
public static partial class Shell32
{
/// <summary>Exposes a method that initializes a handler, such as a property handler, thumbnail handler, or preview handler, with a stream.</summary>
/// <summary>
/// Exposes a method that initializes a handler, such as a property handler, thumbnail handler, or preview handler, with a stream.
/// </summary>
// 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
{
/// <summary>Initializes a handler with a stream.</summary>
/// <param name="pstream">A pointer to an IStream interface that represents the stream source.</param>
/// <param name="grfMode">One of the following STGM values that indicates the access mode for pstream.</param>
void Initialize([In] IStream pstream, STGM grfMode);
/// <summary>
/// <para>Initializes a handler with a stream.</para>
/// </summary>
/// <param name="pstream">
/// <para>Type: <c>IStream*</c></para>
/// <para>A pointer to an IStream interface that represents the stream source.</para>
/// </param>
/// <param name="grfMode">
/// <para>Type: <c>DWORD</c></para>
/// <para>One of the following STGM values that indicates the access mode for .</para>
/// <para>STGM_READ</para>
/// <para>The stream indicated by is read-only.</para>
/// <para>STGM_READWRITE</para>
/// <para>The stream indicated by is read/write accessible.</para>
/// </param>
/// <returns>
/// <para>Type: <c>HRESULT</c></para>
/// <para>If this method succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</para>
/// </returns>
/// <remarks>
/// <para>
/// 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.
/// </para>
/// <para>The stream pointed to by must remain open for the lifetime of the handler or until IPropertyStore::Commit is called.</para>
/// <para>
/// 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 <c>Initialize</c> or it can
/// wait until the calling process attempts to enumerate or read properties before fetching them from the stream.
/// </para>
/// <para>
/// A handler instance should be initialized only once in its lifetime. Attempts by the caller to reinitialize the handler should
/// result in the error .
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-iinitializewithstream-initialize
[PreserveSig]
HRESULT Initialize([In] IStream pstream, STGM grfMode);
}
}
}

View File

@ -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.
/// </param>
void OnFocusChangeIS([In, MarshalAs(UnmanagedType.IUnknown)] object punkObj, [In, MarshalAs(UnmanagedType.Bool)] bool fSetFocus);
/// <returns>If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[PreserveSig]
HRESULT OnFocusChangeIS([In, MarshalAs(UnmanagedType.IUnknown)] object punkObj, [In, MarshalAs(UnmanagedType.Bool)] bool fSetFocus);
}
}
}

View File

@ -6,8 +6,9 @@ namespace Vanara.PInvoke
public static partial class Shell32
{
/// <summary>Exposes methods for the display of rich previews.</summary>
// 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
{
/// <summary>
@ -15,33 +16,45 @@ namespace Vanara.PInvoke
/// </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);
/// <returns>If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[PreserveSig]
HRESULT 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);
/// <returns>If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[PreserveSig]
HRESULT 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();
/// <returns>If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[PreserveSig]
HRESULT 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();
/// <returns>If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[PreserveSig]
HRESULT Unload();
/// <summary>Directs the preview handler to set focus to itself.</summary>
void SetFocus();
/// <returns>If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[PreserveSig]
HRESULT 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 return the HWND from calling the GetFocus Function.
/// </summary>
/// <param name="phwnd">When this method returns, contains a pointer to the HWND returned from calling the GetFocus Function from the preview
/// handler's foreground thread.</param>
/// <returns>If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[PreserveSig]
HRESULT QueryFocus(out IntPtr phwnd);
/// <summary>
/// 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.
/// </summary>
// 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
{
/// <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();
/// <param name="pinfo">A pointer to a PREVIEWHANDLERFRAMEINFO structure that receives accelerator table information.</param>
/// <returns>If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[PreserveSig]
HRESULT GetWindowContext(out PREVIEWHANDLERFRAMEINFO pinfo);
/// <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>
@ -79,21 +95,28 @@ namespace Vanara.PInvoke
}
/// <summary>Exposes methods for applying color and font information to preview handlers.</summary>
// 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
{
/// <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);
/// <returns>If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[PreserveSig]
HRESULT 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);
/// <returns>If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[PreserveSig]
HRESULT 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);
/// <returns>If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[PreserveSig]
HRESULT SetTextColor(COLORREF color);
}
/// <summary>Accelerator table structure. Used by IPreviewHandlerFrame::GetWindowContext.</summary>

View File

@ -10,12 +10,15 @@ namespace Vanara.PInvoke
[PInvokeData("servprov.h")]
public interface IServiceProvider
{
/// <summary>Performs as a factory for services that are exposed through an implementation of IServiceProvider.</summary>
/// <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);
};
/// <param name="ppvObject">The interface specified by the <paramref name="riid"/> parameter.</param>
/// <returns>If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[PreserveSig]
HRESULT QueryService([In, MarshalAs(UnmanagedType.LPStruct)] Guid guidService, [In, MarshalAs(UnmanagedType.LPStruct)] Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObject);
}
}
}

View File

@ -7,21 +7,27 @@ namespace Vanara.PInvoke
public static partial class Shell32
{
/// <summary>
/// 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).
/// </summary>
// 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
{
/// <summary>Initializes a property sheet extension, shortcut menu extension, or drag-and-drop handler.</summary>
/// <param name="pidlFolder">
/// 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.
/// </param>
/// <param name="pdtobj">
/// A pointer to an IDataObject interface object that can be used to retrieve the objects being acted upon.
/// </param>
/// <param name="pdtobj">A pointer to an IDataObject interface object that can be used to retrieve the objects being acted upon.</param>
/// <param name="hkeyProgId">The registry key for the file object or folder type.</param>
void Initialize(PIDL pidlFolder, [In] IDataObject pdtobj, uint hkeyProgId);
/// <returns>If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[PreserveSig]
HRESULT Initialize(PIDL pidlFolder, [In] IDataObject pdtobj, IntPtr hkeyProgId);
}
}
}

View File

@ -25,8 +25,9 @@ namespace Vanara.PInvoke
}
/// <summary>Exposes methods that allow a property sheet handler to add or replace pages in the property sheet displayed for a file object.</summary>
// 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
{
/// <summary>

File diff suppressed because it is too large Load Diff

View File

@ -5,9 +5,32 @@ namespace Vanara.PInvoke
{
public static partial class Shell32
{
/// <summary>Exposes a method that unpins an application shortcut from the Start menu or the taskbar.</summary>
/// <summary>
/// <para>Exposes a method that unpins an application shortcut from the <c>Start</c> menu or the taskbar.</para>
/// </summary>
/// <remarks>
/// <para>When to Implement</para>
/// <para>Windows provides an implementation of this interface as CLSID_StartMenuPin. Third parties do not provide their own implementation.</para>
/// <para>When to Use</para>
/// <para>
/// 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.
/// </para>
/// <para>
/// Note that <c>IStartMenuPinnedList</c> does not remove the shortcuts themselves, it only unpins them. Applications first call
/// IStartMenuPinnedList::RemoveFromList on a shortcut, then delete that shortcut.
/// </para>
/// <para>Compatibility</para>
/// <para>
/// 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.
/// </para>
/// </remarks>
// 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
{
/// <summary>

View File

@ -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;