+ return TRUE;
+}
+#endif // wxUSE_DRAG_AND_DROP
+
+bool wxSetClipboardData(wxDataFormat dataFormat,
+ const void *data,
+ int width, int height)
+{
+ HANDLE handle = 0; // return value of SetClipboardData
+
+ switch (dataFormat)
+ {
+ case wxDF_BITMAP:
+ {
+ wxBitmap *bitmap = (wxBitmap *)data;
+
+ HDC hdcMem = CreateCompatibleDC((HDC) NULL);
+ HDC hdcSrc = CreateCompatibleDC((HDC) NULL);
+ HBITMAP old = (HBITMAP)
+ ::SelectObject(hdcSrc, (HBITMAP)bitmap->GetHBITMAP());
+ HBITMAP hBitmap = CreateCompatibleBitmap(hdcSrc,
+ bitmap->GetWidth(),
+ bitmap->GetHeight());
+ if (!hBitmap)
+ {
+ SelectObject(hdcSrc, old);
+ DeleteDC(hdcMem);
+ DeleteDC(hdcSrc);
+ return FALSE;
+ }
+
+ HBITMAP old1 = (HBITMAP) SelectObject(hdcMem, hBitmap);
+ BitBlt(hdcMem, 0, 0, bitmap->GetWidth(), bitmap->GetHeight(),
+ hdcSrc, 0, 0, SRCCOPY);
+
+ // Select new bitmap out of memory DC
+ SelectObject(hdcMem, old1);
+
+ // Set the data
+ handle = ::SetClipboardData(CF_BITMAP, hBitmap);
+
+ // Clean up
+ SelectObject(hdcSrc, old);
+ DeleteDC(hdcSrc);
+ DeleteDC(hdcMem);
+ break;
+ }
+
+ case wxDF_DIB:
+ {
+#if wxUSE_IMAGE_LOADING_IN_MSW
+ wxBitmap *bitmap = (wxBitmap *)data;
+ HBITMAP hBitmap = (HBITMAP)bitmap->GetHBITMAP();
+ // NULL palette means to use the system one
+ HANDLE hDIB = BitmapToDIB(hBitmap, (HPALETTE)NULL);
+ handle = SetClipboardData(CF_DIB, hDIB);