Clipboard Images and Outlook Express

Visual Studio22
Hey all,



I am trying to get a Bitmap into the clipboard so it can be pasted into

Outlook Express 6.



If I use just a HBITMAP (standard bitmap created with

CreateCompatibleBitmap), it'll be put into the clipboard buffer fine but OE

6 won't recognize it. Word and other programs which support images in the

clipboard can see it.



Here's the code I am currenlty using to do it:

// get our client window DC object

HDC dcClient = ::GetDC(hView);



// create a memory dc object

HDC dcMemory = ::CreateCompatibleDC(dcClient);



// create a bitmap

HBITMAP hBitmap = ::CreateCompatibleBitmap(dcClient, cx, cy);



// select the DDB into the DC object now

HBITMAP hOldImage = (HBITMAP)::SelectObject(dcMemory, hBitmap);



// copy the screen image section to our bitmap

::BitBlt(dcMemory, 0, 0, cx, cy, dcClient, x, y, SRCCOPY);



// de-select the bitmap back out of the dc and free dc resources

::SelectObject(dcMemory, hOldImage);

::DeleteDC(dcMemory);



// Send the Clipboard the data.

::OpenClipboard(NULL);

::EmptyClipboard();

::SetClipboardData(CF_BITMAP, hBitmap); // clipboard owns the HBITMAP

handle now

::CloseClipboard();



::ReleaseDC(hView, dcClient);





What do I need to do differently in order to get OE 6 to paste from the

clipboard? I know it can be done because if you select an image in Word

and put it into the clipboard (by a ctrl-c), OE 6 will paste it just fine.



Thanks.


-