|
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
using global::System;
using global::System.Diagnostics;
using global::System.Diagnostics.CodeAnalysis;
using global::System.Runtime.CompilerServices;
using global::System.Runtime.InteropServices;
using global::System.Runtime.Versioning;
using winmdroot = global::Windows.Win32;
namespace Windows.Win32
{
namespace UI.Shell
{
[Guid("42F85136-DB7E-439C-85F1-E4075D135FC8")]
[SupportedOSPlatform("windows6.0.6000")]
[global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.151+58e949951d.RR")]
internal unsafe partial struct IFileDialog
:IVTable<IFileDialog,IFileDialog.Vtbl>,IComIID {
/// <inheritdoc cref="QueryInterface(global::System.Guid*, void**)"/>
internal unsafe winmdroot.Foundation.HRESULT QueryInterface(in global::System.Guid riid, out void* ppvObject)
{
fixed (void** ppvObjectLocal = &ppvObject)
{
fixed (global::System.Guid* riidLocal = &riid)
{
winmdroot.Foundation.HRESULT __result = this.QueryInterface(riidLocal, ppvObjectLocal);
return __result;
}
}
}
public unsafe winmdroot.Foundation.HRESULT QueryInterface(global::System.Guid* riid, void** ppvObject)
{
return ((delegate *unmanaged [Stdcall]<IFileDialog*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT>)lpVtbl[0])((IFileDialog*)Unsafe.AsPointer(ref this), riid, ppvObject);
}
public uint AddRef()
{
return ((delegate *unmanaged [Stdcall]<IFileDialog*,uint>)lpVtbl[1])((IFileDialog*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return ((delegate *unmanaged [Stdcall]<IFileDialog*,uint>)lpVtbl[2])((IFileDialog*)Unsafe.AsPointer(ref this));
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT Show(IFileDialog* pThis, winmdroot.Foundation.HWND hwndOwner)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.Show(hwndOwner);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
public winmdroot.Foundation.HRESULT Show(winmdroot.Foundation.HWND hwndOwner)
{
return ((delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.Foundation.HWND ,winmdroot.Foundation.HRESULT>)lpVtbl[3])((IFileDialog*)Unsafe.AsPointer(ref this), hwndOwner);
}
/// <inheritdoc cref="SetFileTypes(uint, winmdroot.UI.Shell.Common.COMDLG_FILTERSPEC*)"/>
internal unsafe void SetFileTypes(ReadOnlySpan<winmdroot.UI.Shell.Common.COMDLG_FILTERSPEC> rgFilterSpec)
{
fixed (winmdroot.UI.Shell.Common.COMDLG_FILTERSPEC* rgFilterSpecLocal = rgFilterSpec)
{
this.SetFileTypes((uint )rgFilterSpec.Length, rgFilterSpecLocal);
}
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT SetFileTypes(IFileDialog* pThis, uint cFileTypes, winmdroot.UI.Shell.Common.COMDLG_FILTERSPEC* rgFilterSpec)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.SetFileTypes(cFileTypes, rgFilterSpec);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Sets the file types that the dialog can open or save.</summary>
/// <param name="cFileTypes">
/// <para>Type: <b>UINT</b> The number of elements in the array specified by <i>rgFilterSpec</i>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setfiletypes#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="rgFilterSpec">
/// <para>Type: <b>const <a href="https://docs.microsoft.com/windows/desktop/api/shtypes/ns-shtypes-comdlg_filterspec">COMDLG_FILTERSPEC</a>*</b> A pointer to an array of <a href="https://docs.microsoft.com/windows/desktop/api/shtypes/ns-shtypes-comdlg_filterspec">COMDLG_FILTERSPEC</a> structures, each representing a file type.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setfiletypes#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>HRESULT</b> If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code, including the following: </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>When using the <b>Open</b> dialog, the file types declared there are used to filter the view. When using the <b>Save</b> dialog, these values determine which file name extension is appended to the file name. This method must be called before the dialog is shown and can only be called once for each dialog instance. File types cannot be modified once the Common Item dialog box is displayed.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setfiletypes#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public unsafe void SetFileTypes(uint cFileTypes, winmdroot.UI.Shell.Common.COMDLG_FILTERSPEC* rgFilterSpec)
{
((delegate *unmanaged [Stdcall]<IFileDialog*,uint ,winmdroot.UI.Shell.Common.COMDLG_FILTERSPEC* ,winmdroot.Foundation.HRESULT>)lpVtbl[4])((IFileDialog*)Unsafe.AsPointer(ref this), cFileTypes, rgFilterSpec).ThrowOnFailure();
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT SetFileTypeIndex(IFileDialog* pThis, uint iFileType)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.SetFileTypeIndex(iFileType);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Sets the file type that appears as selected in the dialog.</summary>
/// <param name="iFileType">
/// <para>Type: <b>UINT</b> The index of the file type in the file type array passed to <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setfiletypes">IFileDialog::SetFileTypes</a> in its <i>cFileTypes</i> parameter. Note that this is a one-based index, not zero-based.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setfiletypeindex#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
/// </returns>
/// <remarks>This method must be called before the dialog is showing.</remarks>
public void SetFileTypeIndex(uint iFileType)
{
((delegate *unmanaged [Stdcall]<IFileDialog*,uint ,winmdroot.Foundation.HRESULT>)lpVtbl[5])((IFileDialog*)Unsafe.AsPointer(ref this), iFileType).ThrowOnFailure();
}
/// <inheritdoc cref="GetFileTypeIndex(uint*)"/>
internal unsafe void GetFileTypeIndex(out uint piFileType)
{
fixed (uint* piFileTypeLocal = &piFileType)
{
this.GetFileTypeIndex(piFileTypeLocal);
}
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT GetFileTypeIndex(IFileDialog* pThis, uint* piFileType)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.GetFileTypeIndex(piFileType);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Gets the currently selected file type.</summary>
/// <param name="piFileType">
/// <para>Type: <b>UINT*</b> A pointer to a <b>UINT</b> value that receives the index of the selected file type in the file type array passed to <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setfiletypes">IFileDialog::SetFileTypes</a> in its <i>cFileTypes</i> parameter. <div class="alert"><b>Note</b> This is a one-based index rather than zero-based.</div> <div> </div></para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-getfiletypeindex#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
/// </returns>
/// <remarks><b>IFileDialog::GetFileTypeIndex</b> can be called either while the dialog is open or after it has closed.</remarks>
public unsafe void GetFileTypeIndex(uint* piFileType)
{
((delegate *unmanaged [Stdcall]<IFileDialog*,uint* ,winmdroot.Foundation.HRESULT>)lpVtbl[6])((IFileDialog*)Unsafe.AsPointer(ref this), piFileType).ThrowOnFailure();
}
/// <inheritdoc cref="Advise(winmdroot.UI.Shell.IFileDialogEvents*, uint*)"/>
internal unsafe void Advise(winmdroot.UI.Shell.IFileDialogEvents* pfde, out uint pdwCookie)
{
fixed (uint* pdwCookieLocal = &pdwCookie)
{
this.Advise(pfde, pdwCookieLocal);
}
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT Advise(IFileDialog* pThis, winmdroot.UI.Shell.IFileDialogEvents* pfde, uint* pdwCookie)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.Advise(pfde, pdwCookie);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Assigns an event handler that listens for events coming from the dialog.</summary>
/// <param name="pfde">
/// <para>Type: <b><a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nn-shobjidl_core-ifiledialogevents">IFileDialogEvents</a>*</b> A pointer to an <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nn-shobjidl_core-ifiledialogevents">IFileDialogEvents</a> implementation that will receive events from the dialog.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-advise#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="pdwCookie">
/// <para>Type: <b>DWORD*</b> A pointer to a <b>DWORD</b> that receives a value identifying this event handler. When the client is finished with the dialog, that client must call the <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifiledialog-unadvise">IFileDialog::Unadvise</a> method with this value.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-advise#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
/// </returns>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-advise">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
public unsafe void Advise(winmdroot.UI.Shell.IFileDialogEvents* pfde, uint* pdwCookie)
{
((delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.UI.Shell.IFileDialogEvents* ,uint* ,winmdroot.Foundation.HRESULT>)lpVtbl[7])((IFileDialog*)Unsafe.AsPointer(ref this), pfde, pdwCookie).ThrowOnFailure();
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT Unadvise(IFileDialog* pThis, uint dwCookie)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.Unadvise(dwCookie);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Removes an event handler that was attached through the IFileDialog::Advise method.</summary>
/// <param name="dwCookie">
/// <para>Type: <b>DWORD</b> The <b>DWORD</b> value that represents the event handler. This value is obtained through the <i>pdwCookie</i> parameter of the <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifiledialog-advise">IFileDialog::Advise</a> method.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-unadvise#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
/// </returns>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-unadvise">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
public void Unadvise(uint dwCookie)
{
((delegate *unmanaged [Stdcall]<IFileDialog*,uint ,winmdroot.Foundation.HRESULT>)lpVtbl[8])((IFileDialog*)Unsafe.AsPointer(ref this), dwCookie).ThrowOnFailure();
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT SetOptions(IFileDialog* pThis, winmdroot.UI.Shell.FILEOPENDIALOGOPTIONS fos)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.SetOptions(fos);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Sets flags to control the behavior of the dialog.</summary>
/// <param name="fos">
/// <para>Type: <b>FILEOPENDIALOGOPTIONS</b> One or more of the <a href="https://docs.microsoft.com/windows/win32/api/shobjidl_core/ne-shobjidl_core-_fileopendialogoptions">FILEOPENDIALOGOPTIONS</a> values.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setoptions#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
/// </returns>
/// <remarks>Generally, this method should take the value that was retrieved by <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifiledialog-getoptions">IFileDialog::GetOptions</a> and modify it to include or exclude options by setting the appropriate flags.</remarks>
public void SetOptions(winmdroot.UI.Shell.FILEOPENDIALOGOPTIONS fos)
{
((delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.UI.Shell.FILEOPENDIALOGOPTIONS ,winmdroot.Foundation.HRESULT>)lpVtbl[9])((IFileDialog*)Unsafe.AsPointer(ref this), fos).ThrowOnFailure();
}
/// <inheritdoc cref="GetOptions(winmdroot.UI.Shell.FILEOPENDIALOGOPTIONS*)"/>
internal unsafe void GetOptions(out winmdroot.UI.Shell.FILEOPENDIALOGOPTIONS pfos)
{
fixed (winmdroot.UI.Shell.FILEOPENDIALOGOPTIONS* pfosLocal = &pfos)
{
this.GetOptions(pfosLocal);
}
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT GetOptions(IFileDialog* pThis, winmdroot.UI.Shell.FILEOPENDIALOGOPTIONS* pfos)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.GetOptions(pfos);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Gets the current flags that are set to control dialog behavior.</summary>
/// <param name="pfos">
/// <para>Type: <b>FILEOPENDIALOGOPTIONS*</b> When this method returns successfully, points to a value made up of one or more of the <a href="https://docs.microsoft.com/windows/win32/api/shobjidl_core/ne-shobjidl_core-_fileopendialogoptions">FILEOPENDIALOGOPTIONS</a> values.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-getoptions#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
/// </returns>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-getoptions">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
public unsafe void GetOptions(winmdroot.UI.Shell.FILEOPENDIALOGOPTIONS* pfos)
{
((delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.UI.Shell.FILEOPENDIALOGOPTIONS* ,winmdroot.Foundation.HRESULT>)lpVtbl[10])((IFileDialog*)Unsafe.AsPointer(ref this), pfos).ThrowOnFailure();
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT SetDefaultFolder(IFileDialog* pThis, winmdroot.UI.Shell.IShellItem* psi)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.SetDefaultFolder(psi);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Sets the folder used as a default if there is not a recently used folder value available.</summary>
/// <param name="psi">
/// <para>Type: <b><a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nn-shobjidl_core-ishellitem">IShellItem</a>*</b> A pointer to the interface that represents the folder.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setdefaultfolder#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
/// </returns>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setdefaultfolder">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
public unsafe void SetDefaultFolder(winmdroot.UI.Shell.IShellItem* psi)
{
((delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.UI.Shell.IShellItem* ,winmdroot.Foundation.HRESULT>)lpVtbl[11])((IFileDialog*)Unsafe.AsPointer(ref this), psi).ThrowOnFailure();
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT SetFolder(IFileDialog* pThis, winmdroot.UI.Shell.IShellItem* psi)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.SetFolder(psi);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Sets a folder that is always selected when the dialog is opened, regardless of previous user action.</summary>
/// <param name="psi">
/// <para>Type: <b><a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nn-shobjidl_core-ishellitem">IShellItem</a>*</b> A pointer to the interface that represents the folder.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setfolder#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
/// </returns>
/// <remarks>
/// <para>This folder overrides any "most recently used" folder. If this method is called while the dialog is displayed, it causes the dialog to navigate to the specified folder. In general, we do not recommended the use of this method. If you call <b>SetFolder</b> before you display the dialog box, the most recent location that the user saved to or opened from is not shown. Unless there is a very specific reason for this behavior, it is not a good or expected user experience and should therefore be avoided. In almost all instances, <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setdefaultfolder">IFileDialog::SetDefaultFolder</a> is the better method. As of Windows 7, if the path of the folder specified through <i>psi</i> is the default path of a <a href="https://docs.microsoft.com/previous-versions/windows/desktop/legacy/bb776911(v=vs.85)">known folder</a>, the known folder's current path is used in the dialog. That path might not be the same as the path specified in <i>psi</i>; for instance, if the known folder has been redirected. If the known folder is a library (virtual folders Documents, Music, Pictures, and Videos), the library's path is used in the dialog. If the specified library is hidden (as they are by default as of Windows 8.1), the library's default save location is used in the dialog, such as the Microsoft OneDrive Documents folder for the Documents library. Because of these mappings, the folder location used in the dialog might not be exactly as you specified when you called this method.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setfolder#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public unsafe void SetFolder(winmdroot.UI.Shell.IShellItem* psi)
{
((delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.UI.Shell.IShellItem* ,winmdroot.Foundation.HRESULT>)lpVtbl[12])((IFileDialog*)Unsafe.AsPointer(ref this), psi).ThrowOnFailure();
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT GetFolder(IFileDialog* pThis, winmdroot.UI.Shell.IShellItem** ppsi)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.GetFolder(ppsi);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Gets either the folder currently selected in the dialog, or, if the dialog is not currently displayed, the folder that is to be selected when the dialog is opened.</summary>
/// <param name="ppsi">
/// <para>Type: <b><a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nn-shobjidl_core-ishellitem">IShellItem</a>**</b> The address of a pointer to the interface that represents the folder.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-getfolder#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
/// </returns>
/// <remarks>The calling application is responsible for releasing the retrieved <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nn-shobjidl_core-ishellitem">IShellItem</a> when it is no longer needed.</remarks>
public unsafe void GetFolder(winmdroot.UI.Shell.IShellItem** ppsi)
{
((delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.UI.Shell.IShellItem** ,winmdroot.Foundation.HRESULT>)lpVtbl[13])((IFileDialog*)Unsafe.AsPointer(ref this), ppsi).ThrowOnFailure();
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT GetCurrentSelection(IFileDialog* pThis, winmdroot.UI.Shell.IShellItem** ppsi)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.GetCurrentSelection(ppsi);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Gets the user's current selection in the dialog.</summary>
/// <param name="ppsi">
/// <para>Type: <b><a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nn-shobjidl_core-ishellitem">IShellItem</a>**</b> The address of a pointer to the interface that represents the item currently selected in the dialog. This item can be a file or folder selected in the view window, or something that the user has entered into the dialog's edit box. The latter case may require a parsing operation (cancelable by the user) that blocks the current thread.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-getcurrentselection#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
/// </returns>
/// <remarks>The calling application is responsible for releasing the retrieved <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nn-shobjidl_core-ishellitem">IShellItem</a> when it is no longer needed.</remarks>
public unsafe void GetCurrentSelection(winmdroot.UI.Shell.IShellItem** ppsi)
{
((delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.UI.Shell.IShellItem** ,winmdroot.Foundation.HRESULT>)lpVtbl[14])((IFileDialog*)Unsafe.AsPointer(ref this), ppsi).ThrowOnFailure();
}
/// <inheritdoc cref="SetFileName(winmdroot.Foundation.PCWSTR)"/>
internal unsafe void SetFileName(string pszName)
{
fixed (char* pszNameLocal = pszName)
{
this.SetFileName(pszNameLocal);
}
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT SetFileName(IFileDialog* pThis, winmdroot.Foundation.PCWSTR pszName)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.SetFileName(pszName);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Sets the file name that appears in the File name edit box when that dialog box is opened.</summary>
/// <param name="pszName">
/// <para>Type: <b>LPCWSTR</b> A pointer to the name of the file.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setfilename#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
/// </returns>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setfilename">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
public void SetFileName(winmdroot.Foundation.PCWSTR pszName)
{
((delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.Foundation.PCWSTR ,winmdroot.Foundation.HRESULT>)lpVtbl[15])((IFileDialog*)Unsafe.AsPointer(ref this), pszName).ThrowOnFailure();
}
/// <inheritdoc cref="GetFileName(winmdroot.Foundation.PWSTR*)"/>
internal unsafe void GetFileName(out winmdroot.Foundation.PWSTR pszName)
{
fixed (winmdroot.Foundation.PWSTR* pszNameLocal = &pszName)
{
this.GetFileName(pszNameLocal);
}
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT GetFileName(IFileDialog* pThis, winmdroot.Foundation.PWSTR* pszName)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.GetFileName(pszName);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Retrieves the text currently entered in the dialog's File name edit box.</summary>
/// <param name="pszName">
/// <para>Type: <b>WCHAR**</b> The address of a pointer to a buffer that, when this method returns successfully, receives the text.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-getfilename#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
/// </returns>
/// <remarks>
/// <para>The text in the <b>File name</b> edit box does not necessarily reflect the item the user chose. To get the item the user chose, use <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifiledialog-getresult">IFileDialog::GetResult</a>. The calling application is responsible for releasing the retrieved buffer by using the <a href="https://docs.microsoft.com/windows/desktop/api/combaseapi/nf-combaseapi-cotaskmemfree">CoTaskMemFree</a> function.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-getfilename#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public unsafe void GetFileName(winmdroot.Foundation.PWSTR* pszName)
{
((delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.Foundation.PWSTR* ,winmdroot.Foundation.HRESULT>)lpVtbl[16])((IFileDialog*)Unsafe.AsPointer(ref this), pszName).ThrowOnFailure();
}
/// <inheritdoc cref="SetTitle(winmdroot.Foundation.PCWSTR)"/>
internal unsafe void SetTitle(string pszTitle)
{
fixed (char* pszTitleLocal = pszTitle)
{
this.SetTitle(pszTitleLocal);
}
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT SetTitle(IFileDialog* pThis, winmdroot.Foundation.PCWSTR pszTitle)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.SetTitle(pszTitle);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Sets the title of the dialog.</summary>
/// <param name="pszTitle">
/// <para>Type: <b>LPCWSTR</b> A pointer to a buffer that contains the title text.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-settitle#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
/// </returns>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-settitle">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
public void SetTitle(winmdroot.Foundation.PCWSTR pszTitle)
{
((delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.Foundation.PCWSTR ,winmdroot.Foundation.HRESULT>)lpVtbl[17])((IFileDialog*)Unsafe.AsPointer(ref this), pszTitle).ThrowOnFailure();
}
/// <inheritdoc cref="SetOkButtonLabel(winmdroot.Foundation.PCWSTR)"/>
internal unsafe void SetOkButtonLabel(string pszText)
{
fixed (char* pszTextLocal = pszText)
{
this.SetOkButtonLabel(pszTextLocal);
}
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT SetOkButtonLabel(IFileDialog* pThis, winmdroot.Foundation.PCWSTR pszText)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.SetOkButtonLabel(pszText);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Sets the text of the Open or Save button.</summary>
/// <param name="pszText">
/// <para>Type: <b>LPCWSTR</b> A pointer to a buffer that contains the button text.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setokbuttonlabel#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
/// </returns>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setokbuttonlabel">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
public void SetOkButtonLabel(winmdroot.Foundation.PCWSTR pszText)
{
((delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.Foundation.PCWSTR ,winmdroot.Foundation.HRESULT>)lpVtbl[18])((IFileDialog*)Unsafe.AsPointer(ref this), pszText).ThrowOnFailure();
}
/// <inheritdoc cref="SetFileNameLabel(winmdroot.Foundation.PCWSTR)"/>
internal unsafe void SetFileNameLabel(string pszLabel)
{
fixed (char* pszLabelLocal = pszLabel)
{
this.SetFileNameLabel(pszLabelLocal);
}
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT SetFileNameLabel(IFileDialog* pThis, winmdroot.Foundation.PCWSTR pszLabel)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.SetFileNameLabel(pszLabel);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Sets the text of the label next to the file name edit box.</summary>
/// <param name="pszLabel">
/// <para>Type: <b>LPCWSTR</b> A pointer to a buffer that contains the label text.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setfilenamelabel#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
/// </returns>
/// <remarks>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setfilenamelabel">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
public void SetFileNameLabel(winmdroot.Foundation.PCWSTR pszLabel)
{
((delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.Foundation.PCWSTR ,winmdroot.Foundation.HRESULT>)lpVtbl[19])((IFileDialog*)Unsafe.AsPointer(ref this), pszLabel).ThrowOnFailure();
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT GetResult(IFileDialog* pThis, winmdroot.UI.Shell.IShellItem** ppsi)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.GetResult(ppsi);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Gets the choice that the user made in the dialog.</summary>
/// <param name="ppsi">
/// <para>Type: <b><a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nn-shobjidl_core-ishellitem">IShellItem</a>**</b> The address of a pointer to an <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nn-shobjidl_core-ishellitem">IShellItem</a> that represents the user's choice.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-getresult#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
/// </returns>
/// <remarks>
/// <para><b>IFileDialog::GetResult</b> can be called after the dialog has closed or during the handling of an <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifiledialogevents-onfileok">OnFileOk</a> event. Calling this method at any other time will fail. If multiple items were chosen, this method will fail. In the case of multiple items, call <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifileopendialog-getresults">GetResults</a></para>
/// <para><a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nf-shobjidl_core-imodalwindow-show">Show</a> must return a success code for a result to be available to <b>IFileDialog::GetResult</b>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-getresult#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public unsafe winmdroot.Foundation.HRESULT GetResult(winmdroot.UI.Shell.IShellItem** ppsi)
{
return ((delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.UI.Shell.IShellItem** ,winmdroot.Foundation.HRESULT>)lpVtbl[20])((IFileDialog*)Unsafe.AsPointer(ref this), ppsi);
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT AddPlace(IFileDialog* pThis, winmdroot.UI.Shell.IShellItem* psi, winmdroot.UI.Shell.FDAP fdap)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.AddPlace(psi, fdap);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Adds a folder to the list of places available for the user to open or save items.</summary>
/// <param name="psi">
/// <para>Type: <b><a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nn-shobjidl_core-ishellitem">IShellItem</a>*</b> A pointer to an <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nn-shobjidl_core-ishellitem">IShellItem</a> that represents the folder to be made available to the user. This can only be a folder.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-addplace#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="fdap">
/// <para>Type: <b><a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/ne-shobjidl_core-fdap">FDAP</a></b> Specifies where the folder is placed within the list. See <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/ne-shobjidl_core-fdap">FDAP</a>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-addplace#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
/// </returns>
/// <remarks><a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nf-shobjidl_core-shsettemporarypropertyforitem">SHSetTemporaryPropertyForItem</a> can be used to set a temporary <a href="https://docs.microsoft.com/windows/desktop/properties/props-system-itemnamedisplay">PKEY_ItemNameDisplay</a> property on the item represented by the <i>psi</i> parameter. The value for this property will be used in place of the item's UI name.</remarks>
public unsafe void AddPlace(winmdroot.UI.Shell.IShellItem* psi, winmdroot.UI.Shell.FDAP fdap)
{
((delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.UI.Shell.IShellItem* ,winmdroot.UI.Shell.FDAP ,winmdroot.Foundation.HRESULT>)lpVtbl[21])((IFileDialog*)Unsafe.AsPointer(ref this), psi, fdap).ThrowOnFailure();
}
/// <inheritdoc cref="SetDefaultExtension(winmdroot.Foundation.PCWSTR)"/>
internal unsafe void SetDefaultExtension(string pszDefaultExtension)
{
fixed (char* pszDefaultExtensionLocal = pszDefaultExtension)
{
this.SetDefaultExtension(pszDefaultExtensionLocal);
}
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT SetDefaultExtension(IFileDialog* pThis, winmdroot.Foundation.PCWSTR pszDefaultExtension)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.SetDefaultExtension(pszDefaultExtension);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Sets the default extension to be added to file names.</summary>
/// <param name="pszDefaultExtension">
/// <para>Type: <b>LPCWSTR</b> A pointer to a buffer that contains the extension text. This string should not include a leading period. For example, "jpg" is correct, while ".jpg" is not.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setdefaultextension#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
/// </returns>
/// <remarks>If this method is called before showing the dialog, the dialog will update the default extension automatically when the user chooses a new file type (see <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setfiletypes">SetFileTypes</a>).</remarks>
public void SetDefaultExtension(winmdroot.Foundation.PCWSTR pszDefaultExtension)
{
((delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.Foundation.PCWSTR ,winmdroot.Foundation.HRESULT>)lpVtbl[22])((IFileDialog*)Unsafe.AsPointer(ref this), pszDefaultExtension).ThrowOnFailure();
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT Close(IFileDialog* pThis, winmdroot.Foundation.HRESULT hr)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.Close(hr);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Closes the dialog.</summary>
/// <param name="hr">
/// <para>Type: <b>HRESULT</b> The code that will be returned by <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nf-shobjidl_core-imodalwindow-show">Show</a> to indicate that the dialog was closed before a selection was made.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-close#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
/// </returns>
/// <remarks>
/// <para>An application can call this method from a callback method or function while the dialog is open. The dialog will close and the <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nf-shobjidl_core-imodalwindow-show">Show</a> method will return with the <b>HRESULT</b> specified in <i>hr</i>. If this method is called, there is no result available for the <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifiledialog-getresult">IFileDialog::GetResult</a> or <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifileopendialog-getresults">GetResults</a> methods, and they will fail if called.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-close#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public void Close(winmdroot.Foundation.HRESULT hr)
{
((delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.Foundation.HRESULT ,winmdroot.Foundation.HRESULT>)lpVtbl[23])((IFileDialog*)Unsafe.AsPointer(ref this), hr).ThrowOnFailure();
}
/// <inheritdoc cref="SetClientGuid(global::System.Guid*)"/>
internal unsafe void SetClientGuid(in global::System.Guid guid)
{
fixed (global::System.Guid* guidLocal = &guid)
{
this.SetClientGuid(guidLocal);
}
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT SetClientGuid(IFileDialog* pThis, global::System.Guid* guid)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.SetClientGuid(guid);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Enables a calling application to associate a GUID with a dialog's persisted state.</summary>
/// <param name="guid">
/// <para>Type: <b>REFGUID</b> The GUID to associate with this dialog state.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setclientguid#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
/// </returns>
/// <remarks>
/// <para>A dialog's state can include factors such as the last visited folder and the position and size of the dialog. Typically, this state is persisted based on the name of the executable file. By specifying a GUID, an application can have different persisted states for different versions of the dialog within the same application (for example, an import dialog and an open dialog).</para>
/// <para><b>IFileDialog::SetClientGuid</b> should be called immediately after creation of the dialog object.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setclientguid#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public unsafe void SetClientGuid(global::System.Guid* guid)
{
((delegate *unmanaged [Stdcall]<IFileDialog*,global::System.Guid* ,winmdroot.Foundation.HRESULT>)lpVtbl[24])((IFileDialog*)Unsafe.AsPointer(ref this), guid).ThrowOnFailure();
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT ClearClientData(IFileDialog* pThis)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.ClearClientData();
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Instructs the dialog to clear all persisted state information.</summary>
/// <returns>
/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
/// </returns>
/// <remarks>Persisted information can be associated with an application or a GUID. If a GUID was set by using <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setclientguid">IFileDialog::SetClientGuid</a>, that GUID is used to clear persisted information.</remarks>
public void ClearClientData()
{
((delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.Foundation.HRESULT>)lpVtbl[25])((IFileDialog*)Unsafe.AsPointer(ref this)).ThrowOnFailure();
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT SetFilter(IFileDialog* pThis, winmdroot.UI.Shell.IShellItemFilter* pFilter)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.SetFilter(pFilter);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>SetFilter is no longer available for use as of Windows 7.</summary>
/// <param name="pFilter">
/// <para>Type: <b><a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nn-shobjidl_core-ishellitemfilter">IShellItemFilter</a>*</b> A pointer to the <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nn-shobjidl_core-ishellitemfilter">IShellItemFilter</a> that is to be set.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setfilter#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
/// </returns>
/// <remarks>
/// <para>This method can be used if the application needs to perform special filtering to remove some items from the dialog box's view. <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ishellitemfilter-includeitem">IncludeItem</a> will be called for each item that would normally be included in the view. <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ishellitemfilter-getenumflagsforitem">GetEnumFlagsForItem</a> is not used. To filter by file type, <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setfiletypes">IFileDialog::SetFileTypes</a> should be used, because in folders with a large number of items it may offer better performance than applying an <a href="https://docs.microsoft.com/windows/desktop/api/shobjidl_core/nn-shobjidl_core-ishellitemfilter">IShellItemFilter</a>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setfilter#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public unsafe void SetFilter(winmdroot.UI.Shell.IShellItemFilter* pFilter)
{
((delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.UI.Shell.IShellItemFilter* ,winmdroot.Foundation.HRESULT>)lpVtbl[26])((IFileDialog*)Unsafe.AsPointer(ref this), pFilter).ThrowOnFailure();
}
internal unsafe global::Windows.Win32.Foundation.HRESULT QueryInterface<T>(out T* ppv)
where T : unmanaged
{
var hr = this.QueryInterface(typeof(T).GUID, out void* pv);
if (hr.Succeeded)
{
ppv = (T*)pv;
}
else
{
ppv = null;
}
return hr;
}
internal struct Vtbl
{
internal delegate *unmanaged [Stdcall]<IFileDialog*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT> QueryInterface_1;
internal delegate *unmanaged [Stdcall]<IFileDialog*,uint> AddRef_2;
internal delegate *unmanaged [Stdcall]<IFileDialog*,uint> Release_3;
internal delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.Foundation.HWND ,winmdroot.Foundation.HRESULT> Show_4;
internal delegate *unmanaged [Stdcall]<IFileDialog*,uint ,winmdroot.UI.Shell.Common.COMDLG_FILTERSPEC* ,winmdroot.Foundation.HRESULT> SetFileTypes_5;
internal delegate *unmanaged [Stdcall]<IFileDialog*,uint ,winmdroot.Foundation.HRESULT> SetFileTypeIndex_6;
internal delegate *unmanaged [Stdcall]<IFileDialog*,uint* ,winmdroot.Foundation.HRESULT> GetFileTypeIndex_7;
internal delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.UI.Shell.IFileDialogEvents* ,uint* ,winmdroot.Foundation.HRESULT> Advise_8;
internal delegate *unmanaged [Stdcall]<IFileDialog*,uint ,winmdroot.Foundation.HRESULT> Unadvise_9;
internal delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.UI.Shell.FILEOPENDIALOGOPTIONS ,winmdroot.Foundation.HRESULT> SetOptions_10;
internal delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.UI.Shell.FILEOPENDIALOGOPTIONS* ,winmdroot.Foundation.HRESULT> GetOptions_11;
internal delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.UI.Shell.IShellItem* ,winmdroot.Foundation.HRESULT> SetDefaultFolder_12;
internal delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.UI.Shell.IShellItem* ,winmdroot.Foundation.HRESULT> SetFolder_13;
internal delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.UI.Shell.IShellItem** ,winmdroot.Foundation.HRESULT> GetFolder_14;
internal delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.UI.Shell.IShellItem** ,winmdroot.Foundation.HRESULT> GetCurrentSelection_15;
internal delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.Foundation.PCWSTR ,winmdroot.Foundation.HRESULT> SetFileName_16;
internal delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.Foundation.PWSTR* ,winmdroot.Foundation.HRESULT> GetFileName_17;
internal delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.Foundation.PCWSTR ,winmdroot.Foundation.HRESULT> SetTitle_18;
internal delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.Foundation.PCWSTR ,winmdroot.Foundation.HRESULT> SetOkButtonLabel_19;
internal delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.Foundation.PCWSTR ,winmdroot.Foundation.HRESULT> SetFileNameLabel_20;
internal delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.UI.Shell.IShellItem** ,winmdroot.Foundation.HRESULT> GetResult_21;
internal delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.UI.Shell.IShellItem* ,winmdroot.UI.Shell.FDAP ,winmdroot.Foundation.HRESULT> AddPlace_22;
internal delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.Foundation.PCWSTR ,winmdroot.Foundation.HRESULT> SetDefaultExtension_23;
internal delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.Foundation.HRESULT ,winmdroot.Foundation.HRESULT> Close_24;
internal delegate *unmanaged [Stdcall]<IFileDialog*,global::System.Guid* ,winmdroot.Foundation.HRESULT> SetClientGuid_25;
internal delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.Foundation.HRESULT> ClearClientData_26;
internal delegate *unmanaged [Stdcall]<IFileDialog*,winmdroot.UI.Shell.IShellItemFilter* ,winmdroot.Foundation.HRESULT> SetFilter_27;
}
public static void PopulateVTable(Vtbl* vtable)
{
vtable->Show_4 = &Show;
vtable->SetFileTypes_5 = &SetFileTypes;
vtable->SetFileTypeIndex_6 = &SetFileTypeIndex;
vtable->GetFileTypeIndex_7 = &GetFileTypeIndex;
vtable->Advise_8 = &Advise;
vtable->Unadvise_9 = &Unadvise;
vtable->SetOptions_10 = &SetOptions;
vtable->GetOptions_11 = &GetOptions;
vtable->SetDefaultFolder_12 = &SetDefaultFolder;
vtable->SetFolder_13 = &SetFolder;
vtable->GetFolder_14 = &GetFolder;
vtable->GetCurrentSelection_15 = &GetCurrentSelection;
vtable->SetFileName_16 = &SetFileName;
vtable->GetFileName_17 = &GetFileName;
vtable->SetTitle_18 = &SetTitle;
vtable->SetOkButtonLabel_19 = &SetOkButtonLabel;
vtable->SetFileNameLabel_20 = &SetFileNameLabel;
vtable->GetResult_21 = &GetResult;
vtable->AddPlace_22 = &AddPlace;
vtable->SetDefaultExtension_23 = &SetDefaultExtension;
vtable->Close_24 = &Close;
vtable->SetClientGuid_25 = &SetClientGuid;
vtable->ClearClientData_26 = &ClearClientData;
vtable->SetFilter_27 = &SetFilter;
}
private void** lpVtbl;
/// <summary>The IID guid for this interface.</summary>
/// <value>{42f85136-db7e-439c-85f1-e4075d135fc8}</value>
internal static readonly Guid IID_Guid = new Guid(0x42F85136, 0xDB7E, 0x439C, 0x85, 0xF1, 0xE4, 0x07, 0x5D, 0x13, 0x5F, 0xC8);
static ref readonly Guid IComIID.Guid {
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
0x36,0x51,0xF8,0x42,0x7E,0xDB,0x9C,0x43,0x85,0xF1,0xE4,0x07,0x5D,0x13,0x5F,0xC8 };
return ref Unsafe.As<byte,Guid>(ref MemoryMarshal.GetReference(data));
}
}
[Guid("42F85136-DB7E-439C-85F1-E4075D135FC8"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown),ComImport()]
[SupportedOSPlatform("windows6.0.6000")]
internal interface Interface
:winmdroot.UI.Shell.IModalWindow.Interface {
[PreserveSig()]
new winmdroot.Foundation.HRESULT Show(winmdroot.Foundation.HWND hwndOwner);
[PreserveSig()]
unsafe winmdroot.Foundation.HRESULT SetFileTypes(uint cFileTypes, winmdroot.UI.Shell.Common.COMDLG_FILTERSPEC* rgFilterSpec);
[PreserveSig()]
winmdroot.Foundation.HRESULT SetFileTypeIndex(uint iFileType);
[PreserveSig()]
unsafe winmdroot.Foundation.HRESULT GetFileTypeIndex(uint* piFileType);
[PreserveSig()]
unsafe winmdroot.Foundation.HRESULT Advise(winmdroot.UI.Shell.IFileDialogEvents* pfde, uint* pdwCookie);
[PreserveSig()]
winmdroot.Foundation.HRESULT Unadvise(uint dwCookie);
[PreserveSig()]
winmdroot.Foundation.HRESULT SetOptions(winmdroot.UI.Shell.FILEOPENDIALOGOPTIONS fos);
[PreserveSig()]
unsafe winmdroot.Foundation.HRESULT GetOptions(winmdroot.UI.Shell.FILEOPENDIALOGOPTIONS* pfos);
[PreserveSig()]
unsafe winmdroot.Foundation.HRESULT SetDefaultFolder(winmdroot.UI.Shell.IShellItem* psi);
[PreserveSig()]
unsafe winmdroot.Foundation.HRESULT SetFolder(winmdroot.UI.Shell.IShellItem* psi);
[PreserveSig()]
unsafe winmdroot.Foundation.HRESULT GetFolder(winmdroot.UI.Shell.IShellItem** ppsi);
[PreserveSig()]
unsafe winmdroot.Foundation.HRESULT GetCurrentSelection(winmdroot.UI.Shell.IShellItem** ppsi);
[PreserveSig()]
winmdroot.Foundation.HRESULT SetFileName(winmdroot.Foundation.PCWSTR pszName);
[PreserveSig()]
unsafe winmdroot.Foundation.HRESULT GetFileName(winmdroot.Foundation.PWSTR* pszName);
[PreserveSig()]
winmdroot.Foundation.HRESULT SetTitle(winmdroot.Foundation.PCWSTR pszTitle);
[PreserveSig()]
winmdroot.Foundation.HRESULT SetOkButtonLabel(winmdroot.Foundation.PCWSTR pszText);
[PreserveSig()]
winmdroot.Foundation.HRESULT SetFileNameLabel(winmdroot.Foundation.PCWSTR pszLabel);
[PreserveSig()]
unsafe winmdroot.Foundation.HRESULT GetResult(winmdroot.UI.Shell.IShellItem** ppsi);
[PreserveSig()]
unsafe winmdroot.Foundation.HRESULT AddPlace(winmdroot.UI.Shell.IShellItem* psi, winmdroot.UI.Shell.FDAP fdap);
[PreserveSig()]
winmdroot.Foundation.HRESULT SetDefaultExtension(winmdroot.Foundation.PCWSTR pszDefaultExtension);
[PreserveSig()]
winmdroot.Foundation.HRESULT Close(winmdroot.Foundation.HRESULT hr);
[PreserveSig()]
unsafe winmdroot.Foundation.HRESULT SetClientGuid(global::System.Guid* guid);
[PreserveSig()]
winmdroot.Foundation.HRESULT ClearClientData();
[PreserveSig()]
unsafe winmdroot.Foundation.HRESULT SetFilter(winmdroot.UI.Shell.IShellItemFilter* pFilter);
}
}
}
}
|