Re: bitmap to clipboard, OLE
-
See the below. Clipboard: Using the OLE Clipboard Mechanism[^] When you call the function to cache the data, you can use the bitmap standard clipboard type documented below. Clipboard Formats[^] Then you can pass in the bitmap handle in the storage structure.
-
See the below. Clipboard: Using the OLE Clipboard Mechanism[^] When you call the function to cache the data, you can use the bitmap standard clipboard type documented below. Clipboard Formats[^] Then you can pass in the bitmap handle in the storage structure.
I tried the following: BOOL CMyFormView::PutDataToClipboard(CBitmap *pBmp) { COleDataSource *pods = new COleDataSource;; HBITMAP hBmp = (HBITMAP) *pBmp; int i = sizeof(*pBmp); HANDLE hData = ::GlobalAlloc(GMEM_FIXED, sizeof(*pBmp)); CBitmap* pData = (CBitmap*) ::GlobalLock (hData); pData = pBmp; BOOL l = ::GlobalUnlock(hData); STGMEDIUM stg; stg.tymed = TYMED_GDI; stg.hBitmap = hBmp; stg.pUnkForRelease = NULL; // Place the data object on the OLE clipboard. CFormApp* ab = (CFormApp*)AfxGetApp(); pods->CacheData(CF_BITMAP, &stg); pods->SetClipboard(); //ab->pods->CacheData (CF_BITMAP, &stg); //ab->pods->SetClipboard (); delete pods; return TRUE; } I'm unable to paste the bitmap in mspaint (and other places). Any ideas? -- modified at 15:20 Tuesday 29th August, 2006