From 8fe461dd7e7ed819ee37eff3792f0377d62ca9ff Mon Sep 17 00:00:00 2001 From: dahall Date: Fri, 17 Jul 2020 15:30:28 -0600 Subject: [PATCH] Added IShellFolder.GetUIObjectOf extension method overload to accept IntPtr[] --- PInvoke/Shell32/ShObjIdl.IShellFolder.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/PInvoke/Shell32/ShObjIdl.IShellFolder.cs b/PInvoke/Shell32/ShObjIdl.IShellFolder.cs index 9fc2c38c..9447eacc 100644 --- a/PInvoke/Shell32/ShObjIdl.IShellFolder.cs +++ b/PInvoke/Shell32/ShObjIdl.IShellFolder.cs @@ -1454,7 +1454,20 @@ namespace Vanara.PInvoke /// parent folder. Each item identifier list must contain exactly one SHITEMID structure followed by a terminating zero. /// /// Receives the interface pointer requested in . - public static T GetUIObjectOf(this IShellFolder sf, HWND hwndOwner, PIDL[] apidl) where T : class => (T)sf.GetUIObjectOf(hwndOwner, (uint)apidl.Length, Array.ConvertAll(apidl, p => p.DangerousGetHandle()), typeof(T).GUID); + public static T GetUIObjectOf(this IShellFolder sf, HWND hwndOwner, PIDL[] apidl) where T : class => GetUIObjectOf(sf, hwndOwner, Array.ConvertAll(apidl, p => p.DangerousGetHandle())); + + /// Extension method to simplify using the method. + /// Type of the interface to get. + /// An instance. + /// + /// A handle to the owner window that the client should specify if it displays a dialog box or message box. + /// + /// + /// An array of pointers to ITEMIDLIST structures, each of which uniquely identifies a file object or subfolder relative to the + /// parent folder. Each item identifier list must contain exactly one SHITEMID structure followed by a terminating zero. + /// + /// Receives the interface pointer requested in . + public static T GetUIObjectOf(this IShellFolder sf, HWND hwndOwner, IntPtr[] apidl) where T : class => (T)sf.GetUIObjectOf(hwndOwner, (uint)apidl.Length, apidl, typeof(T).GUID); /// Specifies methods for sorting category data. ///