using System; using System.Runtime.InteropServices; using Vanara.InteropServices; namespace Vanara.PInvoke { public static partial class Shell32 { /// Exposes methods that allow the caller to retrieve information entered into a search box. /// /// The search box is shown here in an Windows Explorer window frame. /// The frame that contains the search box might also be hosted in another window or in the common file dialog box. /// To access the search dialog, use QueryService using SID_SSearchBoxInfo on a site pointer within the Windows Explorer window. /// When to Implement /// An implementation of this interface is provided with Windows. Third parties do not need to implement their own version. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl/nn-shobjidl-isearchboxinfo [PInvokeData("shobjidl.h", MSDNShortId = "NN:shobjidl.ISearchBoxInfo")] [ComImport, Guid("6af6e03f-d664-4ef4-9626-f7e0ed36755e"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface ISearchBoxInfo { /// Retrieves the contents of the search box as an ICondition object. /// /// Type: REFIID /// A reference to the IID of the interface to retrieve through ppv, typically IID_ICondition. /// /// /// Type: void** /// When this method returns successfully, contains the interface pointer requested in riid. This is typically ICondition. /// /// /// /// As opposed to the text string retrieved by ISearchBoxInfo::GetText, GetCondition retrieves the same information as a /// structured object, the methods of which can be used to parse and manipulate the search string. /// /// /// We recommend that you use the IID_PPV_ARGS macro, defined in Objbase.h, to package the riid and ppv parameters. This /// macro provides the correct IID based on the interface pointed to by the value in ppv, which eliminates the possibility of a /// coding error in riid that could lead to unexpected results. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl/nf-shobjidl-isearchboxinfo-getcondition HRESULT GetCondition( // REFIID riid, void **ppv ); void GetCondition(in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] out object ppv); /// Retrieves the contents of the search box as plain text. /// /// Type: LPWSTR* /// Pointer to a buffer that, when this method returns successfully, receives the full text entered in the search box. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl/nf-shobjidl-isearchboxinfo-gettext HRESULT GetText( LPWSTR *ppsz ); void GetText(out StrPtrUni ppsz); } } }