Bitmap、CBitmap、HBITMAP以及BITMAP的相互转换
构建CBitmap
CBitmap bmp;
bmp.LoadBitmap(ID);
构建HBITMAP
HBitmap = (HBITMAP)LoadImage(NULL,L”C:\\test.bmp”, IMAGE_BITMAP, 0,0, LR_LOADFROMFILE|LR_CREATEDIBSECTION);//载入位图
Bitmap转HBITMAP
HBITMAP hBitmap;
pbm->GetHBITMAP(NULL, &hBitmap);
HBITMAP转CBitmap
bitmap.Attach(hBitmap);
CBitmap转BITMAP
BITMAP bm;
bitmap.GetBitmap(&bm);
HBITMAP转BITMAP
GetObject(hBitmap, sizeof(Bitmap), (LPSTR)&Bitmap);