首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

读取位图RGB值异常

2012-04-11 
读取位图RGB值错误!C/C++ codeCBitmap bitmapBITMAP BitMapif(!bitmap.LoadBitmap(IDB_BITMAP1)){Messag

读取位图RGB值错误!

C/C++ code
CBitmap bitmap;    BITMAP BitMap;    if   (!bitmap.LoadBitmap(IDB_BITMAP1))     {         MessageBox( TEXT("载入失败 "));         }     int   iRetVal = bitmap.GetBitmap(&BitMap);    if(0 == iRetVal)   //这里返回0表示错误     {         DWORD dwLastError = GetLastError();   //这里获取的错误码        dwLastError++;     }     int iCount = BitMap.bmWidthBytes * BitMap.bmHeight;     char *pBits = new char[iCount];       if(pBits)     {        bitmap.GetBitmapBits(iCount,pBits);    }


高手指教错误!
pBits : 没有值!

[解决办法]
你取的位置跑到Bitmap外面了吧。

热点排行