小Kiss!有谁帮我解决一下小问题啊! 非常谢谢! (:)
我想得到给出的 HBITMAP,得到位图的数据,以下是我代码! i值为50,而pdata为空,请赐教!
BITMAPINFO bmpInfo;
BITMAP bmp;
CBitmap m_bmp;
::GetObject(hBitmap,sizeof(BITMAP),&bmp);
//m_bmp.GetBitmap(&bmp);
UINT * pData = new UINT[bmp.bmWidth * bmp.bmHeight];
if(!pData)
MessageBox("asd");
bmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmpInfo.bmiHeader.biWidth = bmp.bmWidth;
bmpInfo.bmiHeader.biHeight = -bmp.bmHeight;
bmpInfo.bmiHeader.biPlanes =1;
bmpInfo.bmiHeader.biCompression = BI_RGB;
bmpInfo.bmiHeader.biBitCount = 1;
int i=GetDIBits(hMemDC, hBitmap,0, bmp.bmHeight, pData,&bmpInfo, DIB_RGB_COLORS);
str.Format("%d",i);
MessageBox(str);
str=*pData;
MessageBox(str);
hBitmap = (HBITMAP)SelectObject(hMemDC, hOldBitmap);