Click to See Complete Forum and Search --> : problem with CBitmap and clipboard


kleineSchild
April 24th, 2006, 02:30 AM
Hello,

I have a problem with CBitmap and clipboard.

This is my code snippet:


CBitmap bitmap;

ASSERT("Test.bmp");
DeleteObject(NULL);

HBITMAP hBitmap = NULL;
(hBitmap = (HBITMAP)LoadImage(NULL, "Test.bmp", IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE | LR_CREATEDIBSECTION | LR_DEFAULTSIZE);

bitmap.Attach(hBitmap);


::OpenClipboard(NULL);
::EmptyClipboard() ;
::SetClipboardData (CF_BITMAP, bitmap.GetSafeHandle() ) ;
::CloseClipboard () ;
bitmap.Detach();


Something is loading into the clipboard, but it can't paste into another program like IrfanView.

What's my fault?

Thanks for your help.

Best regards
Jana