X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/580ffdf4c03b47e37aaede43985ebb3a5b399162..404b319a85dadd7decf7a5a5331020520031a41c:/src/msw/dirdlg.cpp diff --git a/src/msw/dirdlg.cpp b/src/msw/dirdlg.cpp index cdc1022464..1760eb8d91 100644 --- a/src/msw/dirdlg.cpp +++ b/src/msw/dirdlg.cpp @@ -30,6 +30,7 @@ (defined(__HANDHELDPC__) && (_WIN32_WCE >= 500))) #include "wx/dirdlg.h" +#include "wx/testing.h" #ifndef WX_PRECOMP #include "wx/utils.h" @@ -50,7 +51,7 @@ #if wxUSE_DYNLIB_CLASS && !defined(__WXWINCE__) #define wxUSE_IFILEDIALOG 1 #else - #define wxUSE_IFILEDIALOG + #define wxUSE_IFILEDIALOG 0 #endif #if wxUSE_IFILEDIALOG @@ -72,11 +73,15 @@ struct IShellItem : public IUnknown 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); -#endif // #ifndef __IShellItem_INTERFACE_DEFINED__ - struct IShellItemFilter; struct IFileDialogEvents; @@ -216,6 +221,8 @@ void wxDirDialog::SetPath(const wxString& path) int wxDirDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + wxWindow* const parent = GetParent(); WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL; @@ -259,7 +266,7 @@ int wxDirDialog::ShowSHBrowseForFolder(WXHWND owner) #endif bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT; bi.lpfn = BrowseCallbackProc; - bi.lParam = (LPARAM)m_path.wx_str(); // param for the callback + bi.lParam = wxMSW_CONV_LPARAM(m_path); // param for the callback static const int verComCtl32 = wxApp::GetComCtl32Version(); @@ -357,21 +364,21 @@ int wxDirDialog::ShowIFileDialog(WXHWND owner) REFIID, void**); - SHCreateItemFromParsingName_t s_pfnSHCreateItemFromParsingName = NULL; + SHCreateItemFromParsingName_t pfnSHCreateItemFromParsingName = NULL; wxDynamicLibrary dllShell32; if ( dllShell32.Load(wxS("shell32.dll"), wxDL_VERBATIM | wxDL_QUIET) ) { - wxDL_INIT_FUNC(s_pfn, SHCreateItemFromParsingName, dllShell32); + wxDL_INIT_FUNC(pfn, SHCreateItemFromParsingName, dllShell32); } - if ( !s_pfnSHCreateItemFromParsingName ) + if ( !pfnSHCreateItemFromParsingName ) { wxLogLastError(wxS("SHCreateItemFromParsingName() not found")); return wxID_NONE; } wxCOMPtr folder; - hr = s_pfnSHCreateItemFromParsingName(m_path.wc_str(), + hr = pfnSHCreateItemFromParsingName(m_path.wc_str(), NULL, wxIID_PPV_ARGS(IShellItem, &folder)); @@ -486,7 +493,7 @@ BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData) } SendMessage(hwnd, BFFM_SETSTATUSTEXT, - 0, (LPARAM)strDir.wx_str()); + 0, wxMSW_CONV_LPARAM(strDir)); } } break;