Fix wxTaskBarButton code compilation in ANSI mode.

Correctly declare SHStrDupW() as always producing a wide char string on output
and pass a wide string to wxStrlcpy() using a wide char buffer.

Closes #17033.
This commit is contained in:
Vadim Zeitlin 2015-06-21 18:10:37 +02:00
parent 5fabf7e60d
commit 5ae3e4ff12

View File

@ -326,7 +326,7 @@ inline HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar)
ppropvar->vt = VT_LPWSTR;
#if wxUSE_DYNLIB_CLASS
typedef HRESULT (WINAPI *SHStrDupW_t)(LPCTSTR, LPTSTR*);
typedef HRESULT (WINAPI *SHStrDupW_t)(LPCWSTR, LPWSTR*);
static SHStrDupW_t s_pfnSHStrDupW = NULL;
if ( !s_pfnSHStrDupW )
{
@ -939,7 +939,7 @@ bool wxTaskBarButtonImpl::InitOrUpdateThumbBarButtons()
// Truncate the tooltip if its length longer than szTip(THUMBBUTTON)
// allowed length (260).
tooltip.Truncate(260);
wxStrlcpy(buttons[i].szTip, tooltip.t_str(), tooltip.length());
wxStrlcpy(buttons[i].szTip, tooltip.wc_str(), tooltip.length());
buttons[i].dwMask =
static_cast<THUMBBUTTONMASK>(buttons[i].dwMask | THB_TOOLTIP);
}