想要把位图资源中的IDB_BITMAP1的数据放入buf中,为何察看内存中的值和位图中的值不同,而且这样的方法得到的buf是不带文件头的 如何得到它的文件头?有什么方法么?自己写要怎么写呢?
CBitmap bmp;
bmp.LoadBitmapW(IDB_BITMAP1);
BITMAP Bitmap;
bmp.GetBitmap(&Bitmap);
DWORD buflen = Bitmap.bmHeight * Bitmap.bmWidthBytes;
BYTE *buf = new BYTE[buflen];
bmp.GetBitmapBits(buflen,buf);
CBitmap bmp;
bmp.LoadBitmapW(IDB_BITMAP1);
BITMAP Bitmap;
bmp.GetBitmap(&Bitmap);
DWORD buflen = Bitmap.bmHeight * Bitmap.bmWidthBytes;
BYTE *buf = new BYTE[buflen];
bmp.GetBitmapBits(buflen,buf);
if( hRsrc )
{
HGLOBAL hGlobal = LoadResource(hModule,hRsrc);
if( hGlobal )
{
unsigned char*p = (unsigned char*)LockResource(hGlobal);
if( NULL != p )
{
//可以观察一下p的内容,跟位图文件应该是一样的
}
//UnlockResource(hGlobal);
}
DeleteObject(hRsrc);
}位图全面是文件头的信息BITMAPFILEHEADER + BITMAPINFO + 位图数据