CBitmap bitmap;
BOOL bl=bitmap.LoadBitmap(IDB_BITMAP1);//位图资源ID
BITMAP bm;
int iRe=bitmap.GetBitmap(&bm);
//这样函数调用成功,返回值是24,
//但查看bm的bmBits成员时,值为0,这是为什么?

解决方案 »

  1.   

    我也碰到过
    但还是可以用GetBitmapBits()得到阿
      

  2.   

    bitmap.GetBitmap(&bm) 会设置bm的bmHeight, bmWidth等成员, 但bmBits总设为NULL。
    因为这个成员一般是用在产生位图时,如果把它指向已知的像素,就使新位图初始化。
      

  3.   

    use GetBitmapBits()
    Res:
    Copies the bit pattern of the CBitmap object into the buffer that is pointed to by lpBits. The dwCount parameter specifies the number of bytes to be copied to the buffer. Use CGdiObject::GetObject to determine the correct dwCount value for the given bitmap.GetBitmap:
    Res
    Call this member function to retrieve information about a CBitmap object. This information is returned in the BITMAP structure referred to by pBitmap.