#include "wx/dde.h"
#include "wx/intl.h"
#include "wx/hashmap.h"
+#include "wx/math.h"
#include "wx/msw/private.h"
#include <string.h>
#include <ddeml.h>
-#ifdef __GNUWIN32_OLD__
- #include "wx/msw/gnuwin32/extra.h"
-#endif
-
// ----------------------------------------------------------------------------
// macros and constants
// ----------------------------------------------------------------------------
wxDDEServer::~wxDDEServer()
{
- if ( !!m_serviceName )
+ if ( !m_serviceName.IsEmpty() )
{
HSZ hsz = DDEAtomFromString(m_serviceName);
size = wxStrlen(data) + 1;
}
- bool ok = DdeClientTransaction((LPBYTE)data,
+ bool ok = DdeClientTransaction((LPBYTE)data,
size * sizeof(wxChar),
GetHConv(),
NULL,
}
DWORD len = DdeGetData(returned_data, NULL, 0, 0);
+ len = (DWORD)ceil( double(len)/sizeof(wxChar) );
- wxChar *data = GetBufferAtLeast( len/sizeof(wxChar) );
+ wxChar *data = GetBufferAtLeast( len );
wxASSERT_MSG(data != NULL,
_T("Buffer too small in wxDDEConnection::Request") );
(void) DdeGetData(returned_data, (LPBYTE)data, len, 0);
(void) DdeFreeDataHandle(returned_data);
if (size)
- *size = (int)len/sizeof(wxChar);
+ *size = len;
return data;
}
}
HSZ item_atom = DDEGetAtom(item);
- bool ok = DdeClientTransaction((LPBYTE)data,
+ bool ok = DdeClientTransaction((LPBYTE)data,
size * sizeof(wxChar),
GetHConv(),
item_atom, format,
if (connection)
{
DWORD len = DdeGetData(hData, NULL, 0, 0);
+ len = (DWORD)ceil( double(len)/sizeof(wxChar) );
- wxChar *data = connection->GetBufferAtLeast( len/sizeof(wxChar) );
+ wxChar *data = connection->GetBufferAtLeast( len );
wxASSERT_MSG(data != NULL,
_T("Buffer too small in _DDECallback (XTYP_EXECUTE)") );
if ( connection->OnExecute(connection->m_topicName,
data,
- (int)len/sizeof(wxChar),
+ (int)len,
(wxIPCFormat) wFmt) )
{
return (DDERETURN)(DWORD)DDE_FACK;
wxString item_name = DDEStringFromAtom(hsz2);
DWORD len = DdeGetData(hData, NULL, 0, 0);
+ len = (DWORD)ceil( double(len) / sizeof(wxChar) );
- wxChar *data = connection->GetBufferAtLeast( len/sizeof(wxChar) );
+ wxChar *data = connection->GetBufferAtLeast( len );
wxASSERT_MSG(data != NULL,
_T("Buffer too small in _DDECallback (XTYP_EXECUTE)") );
connection->OnPoke(connection->m_topicName,
item_name,
data,
- (int)len/sizeof(wxChar),
+ (int)len,
(wxIPCFormat) wFmt);
return (DDERETURN)DDE_FACK;
wxString item_name = DDEStringFromAtom(hsz2);
DWORD len = DdeGetData(hData, NULL, 0, 0);
+ len = (DWORD)ceil( double(len) / sizeof(wxChar) );
- wxChar *data = connection->GetBufferAtLeast( len/sizeof(wxChar) );
+ wxChar *data = connection->GetBufferAtLeast( len );
wxASSERT_MSG(data != NULL,
_T("Buffer too small in _DDECallback (XTYP_ADVDATA)") );
if ( connection->OnAdvise(connection->m_topicName,
item_name,
data,
- (int)len/sizeof(wxChar),
+ (int)len,
(wxIPCFormat) wFmt) )
{
return (DDERETURN)(DWORD)DDE_FACK;