+ wxCHECK_MSG( format == wxIPC_TEXT ||
+ format == wxIPC_UTF8TEXT ||
+ format == wxIPC_UNICODETEXT,
+ false,
+ _T("wxDDEServer::Execute() supports only text data") );
+
+ wxMemoryBuffer buffer;
+ LPBYTE realData wxDUMMY_INITIALIZE(NULL);
+ size_t realSize wxDUMMY_INITIALIZE(0);
+ wxMBConv *conv = NULL;
+
+ // Windows only supports either ANSI or UTF-16 format depending on the
+ // build, so we need to convert the data if it doesn't use it already
+#if wxUSE_UNICODE
+ if ( format == wxIPC_TEXT )
+ {
+ conv = &wxConvLibc;
+ }
+ else if ( format == wxIPC_UTF8TEXT )
+ {
+ conv = &wxConvUTF8;
+ }
+ else // no conversion necessary for wxIPC_UNICODETEXT
+ {
+ realData = (LPBYTE)data;
+ realSize = size;
+ }
+
+ if ( conv )
+ {
+ const char * const text = (const char *)data;
+ const size_t len = size/sizeof(char);
+
+ realSize = conv->ToWChar(NULL, 0, text, len);
+ if ( realSize == wxCONV_FAILED )
+ return false;
+
+ realData = (LPBYTE)buffer.GetWriteBuf(realSize*sizeof(wchar_t));
+ if ( !realData )
+ return false;
+
+ realSize = conv->ToWChar((wchar_t *)realData, realSize, text, len);
+ if ( realSize == wxCONV_FAILED )
+ return false;
+ }
+#else // !wxUSE_UNICODE
+ if ( format == wxIPC_UNICODETEXT )