Fixed problems with some Shell interfaces

pull/30/head
David Hall 2019-01-11 18:05:27 -07:00
parent 2527cda0d9
commit 2da25331d2
6 changed files with 209 additions and 78 deletions

View File

@ -1,4 +1,5 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
@ -94,6 +95,9 @@ namespace Vanara.PInvoke
HRESULT IncludeObject([In] IShellView ppshv, [In] PIDL pidl);
}
/*
* ICommDlgBrowser2 causes grief in .NET for some reason, so it is being left out.
*
/// <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.
@ -151,39 +155,33 @@ namespace Vanara.PInvoke
[PreserveSig]
HRESULT GetViewFlags(out CDB2GVF pdwFlags);
}
*/
/// <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 : ICommDlgBrowser
public interface ICommDlgBrowser3 //: ICommDlgBrowser // Don't derive as it seems to cause problems with memory allocations.
{
/// <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>
/// <returns>If this method succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</returns>
[PreserveSig]
new HRESULT OnDefaultCommand([In] IShellView ppshv);
HRESULT 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>
/// <returns>If this method succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</returns>
[PreserveSig]
new HRESULT OnStateChange([In] IShellView ppshv, CDBOSC uChange);
HRESULT 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, [In] 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>
/// <returns>If this method succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</returns>
[PreserveSig]
HRESULT Notify([In] IShellView ppshv, CDB2N dwNotifyType);
HRESULT IncludeObject([In] IShellView ppshv, [In] IntPtr pidl);
/// <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>
@ -206,12 +204,12 @@ namespace Vanara.PInvoke
[PreserveSig]
HRESULT GetViewFlags(out CDB2GVF pdwFlags);
/// <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>
/// <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>
/// <returns>If this method succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</returns>
[PreserveSig]
HRESULT OnColumnClicked([In] IShellView ppshv, int iColumn);
HRESULT Notify([In] IShellView ppshv, CDB2N dwNotifyType);
/// <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>
@ -220,11 +218,75 @@ namespace Vanara.PInvoke
[PreserveSig]
HRESULT GetCurrentFilter([MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFileSpec, int cchFileSpec);
/// <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>
/// <returns>If this method succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</returns>
[PreserveSig]
HRESULT OnColumnClicked([In] IShellView ppshv, int iColumn);
/// <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>
/// <returns>If this method succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</returns>
[PreserveSig]
HRESULT OnPreViewCreated([In] IShellView ppshv);
}
/*[ComImport, Guid("c8ad25a1-3294-41ee-8165-71174bd01c57"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ICommDlgBrowser3
{
// dlg1
[PreserveSig]
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
HRESULT OnDefaultCommand(IntPtr ppshv);
[PreserveSig]
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
HRESULT OnStateChange(
IntPtr ppshv,
CDBOSC uChange);
[PreserveSig]
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
HRESULT IncludeObject(
IntPtr ppshv,
IntPtr pidl);
// dlg2
[PreserveSig]
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
HRESULT GetDefaultMenuText(
IShellView shellView,
IntPtr buffer, //A pointer to a buffer that is used by the Shell browser to return the default shortcut menu text.
int bufferMaxLength); //should be max size = 260?
[PreserveSig]
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
HRESULT GetViewFlags(
[Out] out CDB2GVF pdwFlags); // CommDlgBrowser2ViewFlags
[PreserveSig]
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
HRESULT Notify(
IntPtr pshv, CDB2N notifyType);
// dlg3
[PreserveSig]
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
HRESULT GetCurrentFilter(
StringBuilder pszFileSpec,
int cchFileSpec);
[PreserveSig]
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
HRESULT OnColumnClicked(
IShellView ppshv,
int iColumn);
[PreserveSig]
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
HRESULT OnPreViewCreated(IShellView ppshv);
}*/
}
}

View File

@ -1,4 +1,5 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace Vanara.PInvoke
@ -155,7 +156,7 @@ namespace Vanara.PInvoke
/// </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))]
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("DFD3B6B5-C10C-4BE9-85F6-A66969F402F6"), CoClass(typeof(ExplorerBrowser))]
public interface IExplorerBrowser
{
/// <summary>Prepares the browser to be navigated.</summary>
@ -173,7 +174,7 @@ namespace Vanara.PInvoke
/// <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);
void SetRect([In, Out] ref HDWP phdwp, [In] RECT rcBrowser);
/// <summary>Sets the name of the property bag.</summary>
/// <param name="pszPropertyBag">
@ -218,7 +219,7 @@ namespace Vanara.PInvoke
/// 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);
void BrowseToIDList([In] IntPtr 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>
@ -247,27 +248,91 @@ namespace Vanara.PInvoke
}
/// <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))]
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("361bbdc7-e6ee-4e13-be58-58e2240c810f")]
[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>
/// <param name="pidlFolder">
/// <para>Type: <c>PCIDLIST_ABSOLUTE</c></para>
/// <para>A PIDL that specifies the folder.</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>
/// Explorer browser calls this method before it navigates to a folder, that is, before calling
/// IExplorerBrowserEvents::OnNavigationFailed or IExplorerBrowserEvents::OnNavigationComplete.
/// </para>
/// <para>Returning any failure code from this method, including E_NOTIMPL, will cancel the navigation.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-iexplorerbrowserevents-onnavigationpending
// HRESULT OnNavigationPending( PCIDLIST_ABSOLUTE pidlFolder );
[PreserveSig]
HRESULT OnNavigationPending([In] IntPtr 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>
/// <param name="psv">
/// <para>Type: <c>IShellView*</c></para>
/// <para>A pointer to an IShellView.</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>
/// An Explorer browser calls this method to enable the client to perform any modifications to the Explorer browser view before
/// it is shown; for example, to set view modes or folder flags.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-iexplorerbrowserevents-onviewcreated
// HRESULT OnViewCreated( IShellView *psv );
[PreserveSig]
HRESULT 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>
/// <param name="pidlFolder">
/// <para>Type: <c>PCIDLIST_ABSOLUTE</c></para>
/// <para>A PIDL that specifies the folder.</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 called after method IExplorerBrowserEvents::OnViewCreated, assuming a successful view creation.</para>
/// <para>
/// After a navigation and view creation, either <c>IExplorerBrowserEvents::OnNavigationComplete</c> or
/// IExplorerBrowserEvents::OnNavigationFailed is called depending on whether the destination could be navigated to. For example,
/// a failure to navigate includes a destination that is not reached either because there is no route to the path or the user has canceled.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-iexplorerbrowserevents-onnavigationcomplete
// HRESULT OnNavigationComplete( PCIDLIST_ABSOLUTE pidlFolder );
[PreserveSig]
HRESULT OnNavigationComplete([In] IntPtr 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>
/// <param name="pidlFolder">
/// <para>Type: <c>PCIDLIST_ABSOLUTE</c></para>
/// <para>A PIDL that specifies the folder.</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 called after method IExplorerBrowserEvents::OnViewCreated, assuming a successful view creation.</para>
/// <para>
/// After a navigation and view creation, either IExplorerBrowserEvents::OnNavigationComplete or
/// <c>IExplorerBrowserEvents::OnNavigationFailed</c> is called, depending on whether the destination could be navigated to. For
/// example, a failure to navigate includes a destination that is not reached either because there is no route to the path or the
/// user has canceled.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-iexplorerbrowserevents-onnavigationfailed
// HRESULT OnNavigationFailed( PCIDLIST_ABSOLUTE pidlFolder );
[PreserveSig]
HRESULT OnNavigationFailed([In] IntPtr pidlFolder);
}

View File

@ -1,4 +1,5 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace Vanara.PInvoke
@ -101,7 +102,7 @@ namespace Vanara.PInvoke
/// </remarks>
[PInvokeData("shobjidl_core.h", MSDNShortId = "6c051cdc-b7f9-48dc-ba32-38f0f1ee5fda")]
[PreserveSig]
HRESULT GetPaneState(in Guid ep, ref EXPLORERPANESTATE peps);
HRESULT GetPaneState(in Guid ep, out EXPLORERPANESTATE peps);
}
/// <summary>Constant GUIDs used by IExplorerPaneVisibility::GetPaneState.</summary>

View File

@ -237,38 +237,38 @@ namespace Vanara.PInvoke
/// <summary>Sets the selected folder's view mode.</summary>
/// <param name="ViewMode">One of the following values from the FOLDERVIEWMODE enumeration.</param>
void SetCurrentViewMode(FOLDERVIEWMODE ViewMode);
void SetCurrentViewMode([In] FOLDERVIEWMODE ViewMode);
/// <summary>Gets the folder object.</summary>
/// <param name="riid">Reference to the desired IID to represent the folder.</param>
/// <param name="ppv">
/// <returns>
/// When this method returns, contains the interface pointer requested in <paramref name="riid"/>. This is typically IShellFolder
/// or a related interface. This can also be an IShellItemArray with a single element.
/// </param>
[return: MarshalAs(UnmanagedType.IUnknown)]
/// </returns>
[return: MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)]
object GetFolder(in Guid riid);
/// <summary>Gets the identifier of a specific item in the folder view, by index.</summary>
/// <param name="iItemIndex">The index of the item in the view.</param>
/// <param name="ppidl">The address of a pointer to a PIDL containing the item's identifier information.</param>
PIDL Item(int iItemIndex);
/// <returns>The address of a pointer to a PIDL containing the item's identifier information.</returns>
IntPtr Item([In] int iItemIndex);
/// <summary>
/// Gets the number of items in the folder. This can be the number of all items, or a subset such as the number of selected items.
/// </summary>
/// <param name="uFlags">Flags from the _SVGIO enumeration that limit the count to certain types of items.</param>
/// <returns>The number of items (files and folders) displayed in the folder view.</returns>
int ItemCount(SVGIO uFlags);
int ItemCount([In] SVGIO uFlags);
/// <summary>Gets the address of an enumeration object based on the collection of items in the folder view.</summary>
/// <param name="uFlags">_SVGIO values that limit the enumeration to certain types of items.</param>
/// <param name="riid">Reference to the desired IID to represent the folder.</param>
/// <param name="ppv">
/// <returns>
/// When this method returns, contains the interface pointer requested in <paramref name="riid"/>. This is typically an
/// IEnumIDList, IDataObject, or IShellItemArray. If an error occurs, this value is NULL.
/// </param>
[return: MarshalAs(UnmanagedType.IUnknown)]
object Items(SVGIO uFlags, in Guid riid);
/// </returns>
[return: MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 1)]
object Items([In] SVGIO uFlags, in Guid riid);
/// <summary>Gets the index of an item in the folder's view which has been marked by using the SVSI_SELECTIONMARK in IFolderView::SelectItem.</summary>
/// <returns>The index of the marked item.</returns>
@ -281,7 +281,7 @@ namespace Vanara.PInvoke
/// <summary>Gets the position of an item in the folder's view.</summary>
/// <param name="pidl">A pointer to an ITEMIDLIST interface.</param>
/// <returns>The position of the item's upper-left corner.</returns>
Point GetItemPosition([In] PIDL pidl);
Point GetItemPosition([In] IntPtr pidl);
/// <summary>
/// Gets a POINT structure containing the width (x) and height (y) dimensions, including the surrounding white space, of an item.
@ -304,7 +304,7 @@ namespace Vanara.PInvoke
/// <summary>Selects an item in the folder's view.</summary>
/// <param name="iItem">The index of the item to select in the folder's view.</param>
/// <param name="dwFlags">One of the _SVSIF constants that specify the type of selection to apply.</param>
void SelectItem(int iItem, SVSIF dwFlags);
void SelectItem([In] int iItem, [In] SVSIF dwFlags);
/// <summary>Allows the selection and positioning of items visible in the folder's view.</summary>
/// <param name="cidl">The number of items to select.</param>
@ -314,7 +314,7 @@ namespace Vanara.PInvoke
/// name="apidl"/> should be positioned.
/// </param>
/// <param name="dwFlags">One of the _SVSIF constants that specifies the type of selection to apply.</param>
void SelectAndPositionItems(uint cidl, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] PIDL[] apidl, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] Point[] apt, SVSIF dwFlags);
void SelectAndPositionItems([In] uint cidl, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] IntPtr[] apidl, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] Point[] apt, [In] SVSIF dwFlags);
}
/// <summary>
@ -332,38 +332,38 @@ namespace Vanara.PInvoke
/// <summary>Sets the selected folder's view mode.</summary>
/// <param name="ViewMode">One of the following values from the FOLDERVIEWMODE enumeration.</param>
new void SetCurrentViewMode(FOLDERVIEWMODE ViewMode);
new void SetCurrentViewMode([In] FOLDERVIEWMODE ViewMode);
/// <summary>Gets the folder object.</summary>
/// <param name="riid">Reference to the desired IID to represent the folder.</param>
/// <param name="ppv">
/// <returns>
/// When this method returns, contains the interface pointer requested in <paramref name="riid"/>. This is typically IShellFolder
/// or a related interface. This can also be an IShellItemArray with a single element.
/// </param>
[return: MarshalAs(UnmanagedType.IUnknown)]
/// </returns>
[return: MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)]
new object GetFolder(in Guid riid);
/// <summary>Gets the identifier of a specific item in the folder view, by index.</summary>
/// <param name="iItemIndex">The index of the item in the view.</param>
/// <param name="ppidl">The address of a pointer to a PIDL containing the item's identifier information.</param>
new PIDL Item(int iItemIndex);
/// <returns>The address of a pointer to a PIDL containing the item's identifier information.</returns>
new IntPtr Item([In] int iItemIndex);
/// <summary>
/// Gets the number of items in the folder. This can be the number of all items, or a subset such as the number of selected items.
/// </summary>
/// <param name="uFlags">Flags from the _SVGIO enumeration that limit the count to certain types of items.</param>
/// <returns>The number of items (files and folders) displayed in the folder view.</returns>
new int ItemCount(SVGIO uFlags);
new int ItemCount([In] SVGIO uFlags);
/// <summary>Gets the address of an enumeration object based on the collection of items in the folder view.</summary>
/// <param name="uFlags">_SVGIO values that limit the enumeration to certain types of items.</param>
/// <param name="riid">Reference to the desired IID to represent the folder.</param>
/// <param name="ppv">
/// <returns>
/// When this method returns, contains the interface pointer requested in <paramref name="riid"/>. This is typically an
/// IEnumIDList, IDataObject, or IShellItemArray. If an error occurs, this value is NULL.
/// </param>
[return: MarshalAs(UnmanagedType.IUnknown)]
new object Items(SVGIO uFlags, in Guid riid);
/// </returns>
[return: MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 1)]
new object Items([In] SVGIO uFlags, in Guid riid);
/// <summary>Gets the index of an item in the folder's view which has been marked by using the SVSI_SELECTIONMARK in IFolderView::SelectItem.</summary>
/// <returns>The index of the marked item.</returns>
@ -376,7 +376,7 @@ namespace Vanara.PInvoke
/// <summary>Gets the position of an item in the folder's view.</summary>
/// <param name="pidl">A pointer to an ITEMIDLIST interface.</param>
/// <returns>The position of the item's upper-left corner.</returns>
new Point GetItemPosition([In] PIDL pidl);
new Point GetItemPosition([In] IntPtr pidl);
/// <summary>
/// Gets a POINT structure containing the width (x) and height (y) dimensions, including the surrounding white space, of an item.
@ -399,7 +399,7 @@ namespace Vanara.PInvoke
/// <summary>Selects an item in the folder's view.</summary>
/// <param name="iItem">The index of the item to select in the folder's view.</param>
/// <param name="dwFlags">One of the _SVSIF constants that specify the type of selection to apply.</param>
new void SelectItem(int iItem, SVSIF dwFlags);
new void SelectItem([In] int iItem, [In] SVSIF dwFlags);
/// <summary>Allows the selection and positioning of items visible in the folder's view.</summary>
/// <param name="cidl">The number of items to select.</param>
@ -409,7 +409,7 @@ namespace Vanara.PInvoke
/// name="apidl"/> should be positioned.
/// </param>
/// <param name="dwFlags">One of the _SVSIF constants that specifies the type of selection to apply.</param>
new void SelectAndPositionItems(uint cidl, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] PIDL[] apidl, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] Point[] apt, SVSIF dwFlags);
new void SelectAndPositionItems([In] uint cidl, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] IntPtr[] apidl, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] Point[] apt, [In] SVSIF dwFlags);
/// <summary>Groups the view by the given property key and direction.</summary>
/// <param name="key">
@ -462,7 +462,7 @@ namespace Vanara.PInvoke
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifolderview2-setviewproperty
// DEPRECATED_HRESULT SetViewProperty( PCUITEMID_CHILD pidl, REFPROPERTYKEY propkey, REFPROPVARIANT propvar );
[Obsolete]
void SetViewProperty([In] PIDL pidl, in PROPERTYKEY propkey, [In] PROPVARIANT propvar);
void SetViewProperty([In] IntPtr pidl, in PROPERTYKEY propkey, [In] PROPVARIANT propvar);
/// <summary>
/// <para>
@ -488,7 +488,7 @@ namespace Vanara.PInvoke
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifolderview2-getviewproperty
// DEPRECATED_HRESULT GetViewProperty( PCUITEMID_CHILD pidl, REFPROPERTYKEY propkey, PROPVARIANT *ppropvar );
[Obsolete]
void GetViewProperty([In] PIDL pidl, in PROPERTYKEY propkey, [In, Out] PROPVARIANT ppropvar);
void GetViewProperty([In] IntPtr pidl, in PROPERTYKEY propkey, [In, Out] PROPVARIANT ppropvar);
/// <summary>
/// <para>
@ -515,7 +515,7 @@ namespace Vanara.PInvoke
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifolderview2-settileviewproperties
// DEPRECATED_HRESULT SetTileViewProperties( PCUITEMID_CHILD pidl, LPCWSTR pszPropList );
[Obsolete]
void SetTileViewProperties([In] PIDL pidl, [MarshalAs(UnmanagedType.LPWStr)] string pszPropList);
void SetTileViewProperties([In] IntPtr pidl, [In, MarshalAs(UnmanagedType.LPWStr)] string pszPropList);
/// <summary>
/// <para>
@ -541,7 +541,7 @@ namespace Vanara.PInvoke
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifolderview2-setextendedtileviewproperties
// DEPRECATED_HRESULT SetExtendedTileViewProperties( PCUITEMID_CHILD pidl, LPCWSTR pszPropList );
[Obsolete]
void SetExtendedTileViewProperties([In] PIDL pidl, [MarshalAs(UnmanagedType.LPWStr)] string pszPropList);
void SetExtendedTileViewProperties([In] IntPtr pidl, [In, MarshalAs(UnmanagedType.LPWStr)] string pszPropList);
/// <summary>Sets the default text to be used when there are no items in the view.</summary>
/// <param name="iType">
@ -556,7 +556,7 @@ namespace Vanara.PInvoke
/// </param>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifolderview2-settext HRESULT SetText(
// FVTEXTTYPE iType, LPCWSTR pwszText );
void SetText(FVTEXTTYPE iType, [MarshalAs(UnmanagedType.LPWStr)] string pwszText);
void SetText([In] FVTEXTTYPE iType, [In, MarshalAs(UnmanagedType.LPWStr)] string pwszText);
/// <summary>Sets and applies specified folder flags.</summary>
/// <param name="dwMask">
@ -573,7 +573,7 @@ namespace Vanara.PInvoke
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifolderview2-setcurrentfolderflags HRESULT
// SetCurrentFolderFlags( DWORD dwMask, DWORD dwFlags );
void SetCurrentFolderFlags(FOLDERFLAGS dwMask, FOLDERFLAGS dwFlags);
void SetCurrentFolderFlags([In] FOLDERFLAGS dwMask, [In] FOLDERFLAGS dwFlags);
/// <summary>Gets the currently applied folder flags.</summary>
/// <returns>
@ -605,7 +605,7 @@ namespace Vanara.PInvoke
/// </param>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifolderview2-setsortcolumns HRESULT
// SetSortColumns( const SORTCOLUMN *rgSortColumns, int cColumns );
void SetSortColumns([In] SORTCOLUMN[] rgSortColumns, int cColumns);
void SetSortColumns([In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] SORTCOLUMN[] rgSortColumns, [In] int cColumns);
/// <summary>Gets the sort columns currently applied to the view.</summary>
/// <param name="rgSortColumns">
@ -618,7 +618,7 @@ namespace Vanara.PInvoke
/// </param>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifolderview2-getsortcolumns HRESULT
// GetSortColumns( SORTCOLUMN *rgSortColumns, int cColumns );
void GetSortColumns([In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] SORTCOLUMN[] rgSortColumns, int cColumns);
void GetSortColumns([In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] SORTCOLUMN[] rgSortColumns, [In] int cColumns);
/// <summary>Retrieves an object that represents a specified item.</summary>
/// <param name="iItem">
@ -635,8 +635,8 @@ namespace Vanara.PInvoke
/// </returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifolderview2-getitem HRESULT GetItem( int
// iItem, REFIID riid, void **ppv );
[return: MarshalAs(UnmanagedType.IUnknown)]
object GetItem(int iItem, in Guid riid);
[return: MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)]
object GetItem([In] int iItem, in Guid riid);
/// <summary>Gets the next visible item in relation to a given index in the view.</summary>
/// <param name="iStart">
@ -672,7 +672,7 @@ namespace Vanara.PInvoke
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifolderview2-getvisibleitem HRESULT
// GetVisibleItem( int iStart, BOOL fPrevious, int *piItem );
[PreserveSig]
HRESULT GetVisibleItem(int iStart, [MarshalAs(UnmanagedType.Bool)] bool fPrevious, out int piItem);
HRESULT GetVisibleItem([In] int iStart, [In, MarshalAs(UnmanagedType.Bool)] bool fPrevious, out int piItem);
/// <summary>Locates the currently selected item at or after a given index.</summary>
/// <param name="iStart">The index position from which to start searching for the currently selected item.</param>
@ -696,7 +696,7 @@ namespace Vanara.PInvoke
/// </list>
/// </returns>
[PreserveSig]
HRESULT GetSelectedItem(int iStart, out int piItem);
HRESULT GetSelectedItem([In] int iStart, out int piItem);
/// <summary>
/// <para>Gets the current selection as an IShellItemArray.</para>
@ -730,7 +730,7 @@ namespace Vanara.PInvoke
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifolderview2-getselection HRESULT
// GetSelection( BOOL fNoneImpliesFolder, IShellItemArray **ppsia );
[PreserveSig]
HRESULT GetSelection([MarshalAs(UnmanagedType.Bool)] bool fNoneImpliesFolder, out IShellItemArray ppsia);
HRESULT GetSelection([In, MarshalAs(UnmanagedType.Bool)] bool fNoneImpliesFolder, out IShellItemArray ppsia);
/// <summary>Gets the selection state including check state.</summary>
/// <param name="pidl">
@ -746,7 +746,7 @@ namespace Vanara.PInvoke
/// </returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifolderview2-getselectionstate HRESULT
// GetSelectionState( PCUITEMID_CHILD pidl, DWORD *pdwFlags );
SVSIF GetSelectionState([In] PIDL pidl);
SVSIF GetSelectionState([In] IntPtr pidl);
/// <summary>Invokes the given verb on the current selection.</summary>
/// <param name="pszVerb">
@ -756,7 +756,7 @@ namespace Vanara.PInvoke
/// <remarks>If pszVerb is <c>NULL</c>, then the default verb is invoked on the selection.</remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifolderview2-invokeverbonselection HRESULT
// InvokeVerbOnSelection( LPCSTR pszVerb );
void InvokeVerbOnSelection([MarshalAs(UnmanagedType.LPWStr)] string pszVerb);
void InvokeVerbOnSelection([In, MarshalAs(UnmanagedType.LPWStr)] string pszVerb);
/// <summary>Sets and applies the view mode and image size.</summary>
/// <param name="uViewMode">
@ -770,7 +770,7 @@ namespace Vanara.PInvoke
/// <remarks>If iImageSize is -1 then the current default icon size for the view mode is used.</remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifolderview2-setviewmodeandiconsize
// HRESULT SetViewModeAndIconSize( FOLDERVIEWMODE uViewMode, int iImageSize );
void SetViewModeAndIconSize(FOLDERVIEWMODE uViewMode, int iImageSize);
void SetViewModeAndIconSize([In] FOLDERVIEWMODE uViewMode, [In] int iImageSize = -1);
/// <summary>Gets the current view mode and icon size applied to the view.</summary>
/// <param name="puViewMode">
@ -793,7 +793,7 @@ namespace Vanara.PInvoke
/// <remarks>If cVisibleRows is zero, subsetting is turned off.</remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifolderview2-setgroupsubsetcount HRESULT
// SetGroupSubsetCount( UINT cVisibleRows );
void SetGroupSubsetCount(uint cVisibleRows);
void SetGroupSubsetCount([In] uint cVisibleRows);
/// <summary>Gets the count of visible rows displayed for a group's subset.</summary>
/// <returns>
@ -812,7 +812,7 @@ namespace Vanara.PInvoke
/// </param>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifolderview2-setredraw HRESULT SetRedraw(
// BOOL fRedrawOn );
void SetRedraw([MarshalAs(UnmanagedType.Bool)] bool fRedrawOn);
void SetRedraw([In, MarshalAs(UnmanagedType.Bool)] bool fRedrawOn);
/// <summary>
/// Checks to see if this view sourced the current drag-and-drop or cut-and-paste operation (used by drop target objects).

View File

@ -1,4 +1,5 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace Vanara.PInvoke
@ -18,7 +19,9 @@ namespace Vanara.PInvoke
/// <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 Guid guidService, in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 1)] out object ppvObject);
//HRESULT QueryService(in Guid guidService, in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 1)] out object ppvObject);
[MethodImpl(MethodImplOptions.InternalCall)]
HRESULT QueryService(ref Guid guidService, ref Guid riid, out IntPtr ppvObject);
}
}
}

View File

@ -801,14 +801,14 @@ namespace Vanara.PInvoke
/// <summary>Enables or disables modeless dialog boxes. This method is not currently implemented.</summary>
/// <param name="enable"><c>true</c> to enable modeless dialog box windows or <c>false</c> to disable them.</param>
void EnableModeless([MarshalAs(UnmanagedType.Bool)] bool enable);
void EnableModeless([In, MarshalAs(UnmanagedType.Bool)] bool enable);
/// <summary>
/// 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.
/// </summary>
/// <param name="uState">Flag specifying the activation state of the window.</param>
void UIActivate(SVUIA uState);
void UIActivate([In] SVUIA uState);
/// <summary>Refreshes the view's contents in response to user input.</summary>
void Refresh();
@ -828,7 +828,7 @@ namespace Vanara.PInvoke
/// </param>
/// <param name="prcView">The dimensions of the new view, in client coordinates.</param>
/// <returns>The address of the window handle being created.</returns>
HWND CreateViewWindow(IShellView psvPrevious, in FOLDERSETTINGS pfs, IShellBrowser psb, in RECT prcView);
HWND CreateViewWindow([In] IShellView psvPrevious, in FOLDERSETTINGS pfs, [In] IShellBrowser psb, in RECT prcView);
/// <summary>Destroys the view window.</summary>
void DestroyViewWindow();
@ -841,7 +841,7 @@ namespace Vanara.PInvoke
/// <param name="dwReserved">Reserved.</param>
/// <param name="lpfn">The address of the callback function used to add the pages.</param>
/// <param name="lparam">A value that must be passed as the callback function's lparam parameter.</param>
void AddPropertySheetPages(uint dwReserved, [In] AddPropSheetPageProc lpfn, [In] IntPtr lparam);
void AddPropertySheetPages([In, Optional] uint dwReserved, [In] AddPropSheetPageProc lpfn, [In] IntPtr lparam);
/// <summary>Saves the Shell's view settings so the current state can be restored during a subsequent browsing session.</summary>
void SaveViewState();
@ -849,14 +849,14 @@ namespace Vanara.PInvoke
/// <summary>Changes the selection state of one or more items within the Shell view window.</summary>
/// <param name="pidlItem">The address of the ITEMIDLIST structure.</param>
/// <param name="uFlags">One of the _SVSIF constants that specify the type of selection to apply.</param>
void SelectItem(PIDL pidlItem, SVSIF uFlags);
void SelectItem([In] IntPtr pidlItem, [In] SVSIF uFlags);
/// <summary>Gets an interface that refers to data presented in the view.</summary>
/// <param name="uItem">The constants that refer to an aspect of the view.</param>
/// <param name="riid">The identifier of the COM interface being requested.</param>
/// <returns>The address that receives the interface pointer. If an error occurs, the pointer returned must be NULL.</returns>
[return: MarshalAs(UnmanagedType.IUnknown)]
object GetItemObject(SVGIO uItem, in Guid riid);
[return: MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 1)]
object GetItemObject([In] SVGIO uItem, in Guid riid);
}
/// <summary>