diff --git a/build/bakefiles/common.bkl b/build/bakefiles/common.bkl index 1f84d4676e..453f466c87 100644 --- a/build/bakefiles/common.bkl +++ b/build/bakefiles/common.bkl @@ -589,7 +589,6 @@ $(TAB)$(VC_COMPILER) /EP /nologo "$(DOLLAR)(InputPath)" > "$(SETUPHDIR)\wx\msw\r wininet - shlwapi oleacc diff --git a/build/bakefiles/wxpresets/presets/wx_win32.bkl b/build/bakefiles/wxpresets/presets/wx_win32.bkl index 715f6ea811..fd8572cd21 100644 --- a/build/bakefiles/wxpresets/presets/wx_win32.bkl +++ b/build/bakefiles/wxpresets/presets/wx_win32.bkl @@ -299,7 +299,6 @@ rpcrt4 advapi32 wsock32 - shlwapi diff --git a/include/wx/msw/taskbarbutton.h b/include/wx/msw/taskbarbutton.h index 8e25313956..df289d5850 100644 --- a/include/wx/msw/taskbarbutton.h +++ b/include/wx/msw/taskbarbutton.h @@ -20,7 +20,8 @@ namespace { class WXDLLIMPEXP_FWD_CORE ITaskbarList3; } -class WXDLLIMPEXP_CORE wxTaskBarButtonImpl : public wxTaskBarButton { +class WXDLLIMPEXP_CORE wxTaskBarButtonImpl : public wxTaskBarButton +{ public: virtual ~wxTaskBarButtonImpl(); diff --git a/src/msw/taskbarbutton.cpp b/src/msw/taskbarbutton.cpp index 92d4aaf894..c96892b8ae 100644 --- a/src/msw/taskbarbutton.cpp +++ b/src/msw/taskbarbutton.cpp @@ -21,12 +21,20 @@ #if wxUSE_TASKBARBUTTON +#ifdef _MSC_VER + #pragma comment( lib, "shlwapi" ) +#endif + #include "wx/msw/private.h" #include "wx/msw/taskbarbutton.h" #include #include +#if wxUSE_DYNLIB_CLASS + #include "wx/dynlib.h" +#endif // wxUSE_DYNLIB_CLASS + // ---------------------------------------------------------------------------- // Redefine the interfaces: ITaskbarList3, IObjectCollection, // ICustomDestinationList, IShellLink, IShellItem, IApplicationDocumentLists @@ -332,9 +340,32 @@ inline HRESULT InitPropVariantFromBoolean(BOOL fVal, PROPVARIANT *ppropvar) inline HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar) { + HRESULT hr = E_FAIL; ppropvar->vt = VT_LPWSTR; - HRESULT hr = SHStrDupW(psz, &ppropvar->pwszVal); - if (FAILED(hr)) + +#if wxUSE_DYNLIB_CLASS + typedef HRESULT (WINAPI *SHStrDupW_t)(LPCTSTR, LPTSTR*); + static SHStrDupW_t s_pfnSHStrDupW = NULL; + if ( !s_pfnSHStrDupW ) + { + wxDynamicLibrary dll(wxT("shlwapi.dll")); + if ( dll.IsLoaded() ) + { + s_pfnSHStrDupW = (SHStrDupW_t)dll.GetSymbol(wxT("SHStrDupW")); + } + } + + if ( s_pfnSHStrDupW ) + { + hr = s_pfnSHStrDupW(psz, &ppropvar->pwszVal); + } +#elif defined (_MSC_VER) + hr = SHStrDupW(psz, &ppropvar->pwszVal); +#else + wxUnusedVar(psz); +#endif + + if ( FAILED(hr) ) { PropVariantInit(ppropvar); }