Hello,

I have a problem with CBitmap. I want to get a portion of a bitmap and then
display it to a picture control. But it I always fail to do that. What appears in the
control is unidentify picture. This is my code:

BOOL ibool;
CBitmap m_xBitmap;
char *lpBits;
BITMAP pBitmap;

// the actual size of this bitmap resource is 24 * 120
// m_CBitmap is CBitmap type
ibool = m_CBitmap.LoadBitmap(IDB_BITMAP5);
ibool = m_CBitmap.GetBitmap(&pBitmap);
lpBits = new char[576]; // I just want to create 24 * 24 bit
ibool = m_CBitmap.GetBitmapBits(24 * 24, (LPVOID) lpBits);

ibool = m_xBitmap.CreateBitmap(24,24,pBitmap.bmPlanes,pBitmap.bmWidthBytes,NULL);
ibool = m_xBitmap.SetBitmapBits(24 * 24, (LPVOID) lpBits);
m_pHead.SetBitmap(HBITMAP(m_xBitmap)); // m_pHead is picture control

is there something wrong with that?? FYI, I use VC++ 5.0

please help me.

-MRidwan -