bes
April 25th, 2005, 03:48 PM
Hi Experts,
I have the following problem: I need to copy a Bitmap to the Clipboard.
This already works fine when loading a BMP from file:
HBITMAP hBmp = LoadImage (....LR_LOADFROMFILE...);
SetClipboardData (CF_BITMAP, hBmp);
But my app creates a BMP in memory, that means I don't want to store it to file before copying it to the Clipboard. I'm using therefore:
HBITMAP hBmp = CreateBitmap (width, height, x, x, BMP_buffer);
SetClipboardData (CF_BITMAP, hBmp);
I'm getting a Bitmap with correct dimensions into the Clipboard, but the Bitmap content is either black or distored (some picture lines looks fine from time to time only), although the BMP_buffer containes correct BMP info (it looks fine when I store it to file)...
The BMP_buffer was allocated by using GlobalAlloc ()
It would be great if someone could point me to the error...or maybe tell me another way of putting the Bitmap to the Clipboard without using CBitmap.
Thanks!
I have the following problem: I need to copy a Bitmap to the Clipboard.
This already works fine when loading a BMP from file:
HBITMAP hBmp = LoadImage (....LR_LOADFROMFILE...);
SetClipboardData (CF_BITMAP, hBmp);
But my app creates a BMP in memory, that means I don't want to store it to file before copying it to the Clipboard. I'm using therefore:
HBITMAP hBmp = CreateBitmap (width, height, x, x, BMP_buffer);
SetClipboardData (CF_BITMAP, hBmp);
I'm getting a Bitmap with correct dimensions into the Clipboard, but the Bitmap content is either black or distored (some picture lines looks fine from time to time only), although the BMP_buffer containes correct BMP info (it looks fine when I store it to file)...
The BMP_buffer was allocated by using GlobalAlloc ()
It would be great if someone could point me to the error...or maybe tell me another way of putting the Bitmap to the Clipboard without using CBitmap.
Thanks!