+#include "wx/msw/private/comptr.h"
+#include "wx/dynlib.h"
+
+#include <initguid.h>
+
+// We can only use IFileDialog under desktop Windows and we need
+// wxDynamicLibrary for it.
+#if wxUSE_DYNLIB_CLASS && !defined(__WXWINCE__)
+ #define wxUSE_IFILEDIALOG 1
+#else
+ #define wxUSE_IFILEDIALOG 0
+#endif
+
+#if wxUSE_IFILEDIALOG
+// IFileDialog related declarations missing from some compilers headers.
+
+// IShellItem
+#ifndef __IShellItem_INTERFACE_DEFINED__
+
+#ifndef SIGDN_FILESYSPATH
+ #define SIGDN_FILESYSPATH 0x80058000
+#endif
+
+struct IShellItem : public IUnknown
+{
+ virtual HRESULT wxSTDCALL BindToHandler(IBindCtx*, REFGUID, REFIID, void**) = 0;
+ virtual HRESULT wxSTDCALL GetParent(IShellItem**) = 0;
+ virtual HRESULT wxSTDCALL GetDisplayName(DWORD, LPWSTR*) = 0;
+ virtual HRESULT wxSTDCALL GetAttributes(ULONG, ULONG*) = 0;
+ virtual HRESULT wxSTDCALL Compare(IShellItem*, DWORD, int*) = 0;
+};
+
+#endif // #ifndef __IShellItem_INTERFACE_DEFINED__
+
+// Define this GUID in any case, even when __IShellItem_INTERFACE_DEFINED__ is
+// defined in the headers we might still not have it in the actual uuid.lib,
+// this happens with at least VC7 used with its original (i.e. not updated) SDK
+// and there is no harm in defining the GUID unconditionally.
+DEFINE_GUID(IID_IShellItem,
+ 0x43826D1E, 0xE718, 0x42EE, 0xBC, 0x55, 0xA1, 0xE2, 0x61, 0xC3, 0x7B, 0xFE);
+
+struct IShellItemFilter;
+struct IFileDialogEvents;
+
+// IModalWindow
+#ifndef __IModalWindow_INTERFACE_DEFINED__
+
+struct IModalWindow : public IUnknown
+{
+ virtual HRESULT wxSTDCALL Show(HWND) = 0;
+};
+
+#endif // #ifndef __IModalWindow_INTERFACE_DEFINED__
+
+// IFileDialog
+#ifndef __IFileDialog_INTERFACE_DEFINED__
+
+#ifndef FOS_PICKFOLDERS
+ #define FOS_PICKFOLDERS 0x20
+#endif
+
+#ifndef FOS_FORCEFILESYSTEM
+ #define FOS_FORCEFILESYSTEM 0x40
+#endif
+
+struct COMDLG_FILTERSPEC;
+
+struct IFileDialog : public IModalWindow
+{
+ virtual HRESULT wxSTDCALL SetFileTypes(UINT, const COMDLG_FILTERSPEC*) = 0;
+ virtual HRESULT wxSTDCALL SetFileTypeIndex(UINT) = 0;
+ virtual HRESULT wxSTDCALL GetFileTypeIndex(UINT*) = 0;
+ virtual HRESULT wxSTDCALL Advise(IFileDialogEvents*, DWORD*) = 0;
+ virtual HRESULT wxSTDCALL Unadvise(DWORD) = 0;
+ virtual HRESULT wxSTDCALL SetOptions(DWORD) = 0;
+ virtual HRESULT wxSTDCALL GetOptions(DWORD*) = 0;
+ virtual HRESULT wxSTDCALL SetDefaultFolder(IShellItem*) = 0;
+ virtual HRESULT wxSTDCALL SetFolder(IShellItem*) = 0;
+ virtual HRESULT wxSTDCALL GetFolder(IShellItem**) = 0;
+ virtual HRESULT wxSTDCALL GetCurrentSelection(IShellItem**) = 0;
+ virtual HRESULT wxSTDCALL SetFileName(LPCWSTR) = 0;
+ virtual HRESULT wxSTDCALL GetFileName(LPWSTR*) = 0;
+ virtual HRESULT wxSTDCALL SetTitle(LPCWSTR) = 0;
+ virtual HRESULT wxSTDCALL SetOkButtonLabel(LPCWSTR) = 0;
+ virtual HRESULT wxSTDCALL SetFileNameLabel(LPCWSTR) = 0;
+ virtual HRESULT wxSTDCALL GetResult(IShellItem**) = 0;
+ virtual HRESULT wxSTDCALL AddPlace(IShellItem*, DWORD) = 0;
+ virtual HRESULT wxSTDCALL SetDefaultExtension(LPCWSTR) = 0;
+ virtual HRESULT wxSTDCALL Close(HRESULT) = 0;
+ virtual HRESULT wxSTDCALL SetClientGuid(REFGUID) = 0;
+ virtual HRESULT wxSTDCALL ClearClientData() = 0;
+ virtual HRESULT wxSTDCALL SetFilter(IShellItemFilter*) = 0;
+};
+
+DEFINE_GUID(CLSID_FileOpenDialog,
+ 0xDC1C5A9C, 0xE88A, 0x4dde, 0xA5, 0xA1, 0x60, 0xF8, 0x2A, 0x20, 0xAE, 0xF7);
+
+DEFINE_GUID(IID_IFileDialog,
+ 0x42F85136, 0xDB7E, 0x439C, 0x85, 0xF1, 0xE4, 0x07, 0x5D, 0x13, 0x5F, 0xC8);
+
+#endif // #ifndef __IFileDialog_INTERFACE_DEFINED__
+
+#endif // wxUSE_IFILEDIALOG