Question : Replacing CreateDIBSection with CBitmap

hi,

I want to replace CreateDIBSection with CBitmap.
I have a BITMAPINFO structure and a void* to the image bits ....

so the only thing I have to do is ...

// Header:
HBITMAP m_hBmp;
CBitmap m_cbmp;

SetBitmap(LPBITMAPINFO lpBitmapInfo, LPVOID lpBits)
{
  ....
  // OLD: m_hBmp = CreateDIBSection( ... )
  // NEW:
  m_cbmp.DeleteObject();
  m_cbmp.CreateBitmap(lpBitmapInfo->bmiHeader.biWidth,
                      lpBitmapInfo->bmiHeader.biHeight,
                      lpBitmapInfo->bmiHeader.biPlanes,
                      lpBitmapInfo->bmiHeader.biBitCount,
                      lpBits);
  m_hBmp = (HBITMAP)m_cbmp;
  ....
}
unfortunately the result is different?!
Do I miss something?


nil_dib

Answer : Replacing CreateDIBSection with CBitmap

moved to PAQ

** Mindphaser - Community Support Moderator **
Random Solutions  
 
programming4us programming4us