+#if wxUSE_DRAG_AND_DROP
+static bool wxSetClipboardData(wxDataObject *data)
+{
+ size_t size = data->GetDataSize();
+ HANDLE hGlobal = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, size);
+ if ( !hGlobal )
+ {
+ wxLogSysError(_("Failed to allocate %dKb of memory for clipboard "
+ "transfer."), size / 1024);
+
+ return FALSE;
+ }
+
+ LPVOID lpGlobalMemory = ::GlobalLock(hGlobal);
+
+ data->GetDataHere(lpGlobalMemory);
+
+ GlobalUnlock(hGlobal);
+
+ wxDataFormat format = data->GetPreferredFormat();
+ if ( !::SetClipboardData(format, hGlobal) )
+ {
+ wxLogSysError(_("Failed to set clipboard data in format %s"),
+ wxDataObject::GetFormatName(format));
+
+ return FALSE;
+ }
+
+ return TRUE;
+}
+#endif // wxUSE_DRAG_AND_DROP
+