構建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);