if ( conv )
{
const char * const text = (const char *)data;
- const size_t len = size/sizeof(char);
+ const size_t len = size;
realSize = conv->ToWChar(NULL, 0, text, len);
if ( realSize == wxCONV_FAILED )
realSize = conv->ToWChar((wchar_t *)realData, realSize, text, len);
if ( realSize == wxCONV_FAILED )
return false;
+
+ // We need to pass the size of the buffer to DdeClientTransaction() and
+ // not the length of the string.
+ realSize *= sizeof(wchar_t);
}
#else // !wxUSE_UNICODE
if ( format == wxIPC_UNICODETEXT )
if ( realSize == wxCONV_FAILED )
return false;
- realData = (LPBYTE)buffer.GetWriteBuf(realSize*sizeof(char));
+ realData = (LPBYTE)buffer.GetWriteBuf(realSize);
if ( !realData )
return false;
DWORD result;
bool ok = DdeClientTransaction(realData,
- realSize*sizeof(wxChar),
+ realSize,
GetHConv(),
NULL,
// MSDN: if the transaction specified by
{
wxASSERT_MSG( DDEIdInst, wxT("DDE not initialized") );
- HSZ hsz = DdeCreateStringHandle(DDEIdInst, (wxChar*)s.wx_str(), DDE_CP);
+ HSZ hsz = DdeCreateStringHandle(DDEIdInst, wxMSW_CONV_LPTSTR(s), DDE_CP);
if ( !hsz )
{
DDELogError(_("Failed to create DDE string"));