+ case wxDF_BITMAP:
+ {
+ BITMAP bm;
+ HBITMAP hBitmap = (HBITMAP) GetClipboardData(CF_BITMAP);
+ if (!hBitmap)
+ break;
+
+ HDC hdcMem = CreateCompatibleDC((HDC) NULL);
+ HDC hdcSrc = CreateCompatibleDC((HDC) NULL);
+
+ HBITMAP old = (HBITMAP) ::SelectObject(hdcSrc, hBitmap);
+ GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm);
+
+ HBITMAP hNewBitmap = CreateBitmapIndirect(&bm);
+
+ if (!hNewBitmap)
+ {
+ SelectObject(hdcSrc, old);
+ DeleteDC(hdcMem);
+ DeleteDC(hdcSrc);
+ break;
+ }
+
+ HBITMAP old1 = (HBITMAP) SelectObject(hdcMem, hNewBitmap);
+ BitBlt(hdcMem, 0, 0, bm.bmWidth, bm.bmHeight,
+ hdcSrc, 0, 0, SRCCOPY);
+
+ // Select new bitmap out of memory DC
+ SelectObject(hdcMem, old1);
+
+ // Clean up
+ SelectObject(hdcSrc, old);
+ DeleteDC(hdcSrc);
+ DeleteDC(hdcMem);
+
+ // Create and return a new wxBitmap
+ wxBitmap *wxBM = new wxBitmap;
+ wxBM->SetHBITMAP((WXHBITMAP) hNewBitmap);
+ wxBM->SetWidth(bm.bmWidth);
+ wxBM->SetHeight(bm.bmHeight);
+ wxBM->SetDepth(bm.bmPlanes);
+ wxBM->SetOk(TRUE);
+ retval = wxBM;
+ break;
+ }
+
+ case wxDF_METAFILE:
+ case CF_SYLK:
+ case CF_DIF:
+ case CF_TIFF:
+ case CF_PALETTE:
+ case wxDF_DIB:
+ default:
+ {
+ wxLogError(_("Unsupported clipboard format."));
+ return FALSE;
+ }
+
+ case wxDF_OEMTEXT:
+ dataFormat = wxDF_TEXT;
+ // fall through
+
+ case wxDF_TEXT:
+ {
+ HANDLE hGlobalMemory = ::GetClipboardData(dataFormat);
+ if (!hGlobalMemory)
+ break;