Introduction - If you have any usage issues, please Google them yourself
DWORD size=bitmap.bmWidthBytes*bitmap.bmHeight //图片数据大小
LPSTR lpData=(LPSTR)GlobalAlloc(GPTR,size)
int panelsize = 0 //记录调色板大小
if(bitmap.bmBitsPixel<16) //判断是否为真彩色位图
panelsize =(int)pow(2,bitmap.bmBitsPixel*sizeof(RGBQUAD))
BITMAPINFOHEADER*pBInfo = (BITMAPINFOHEADER*)LocalAlloc(LPTR,
sizeof(BITMAPINFO)+panelsize) //位图头指针
pBInfo->biBitCount = bitmap.bmBitsPixel //位图像素
pBInfo->biClrImportant = 0
pBInfo->biCompression = 0
pBInfo->biHeight = bitmap.bmHeight //位图高
pBInfo->biPlanes = bitmap.bmPlanes
pBInfo->biSize = sizeof(BITMAPINFO)
pBInfo->biSizeImage = bitmap.bmWidthBytes*bitmap.bmHeight //数据
pBInfo->biWidth = bitmap.bmWidth //位图宽
pBInfo->biXPelsPerMeter = 0
pBInfo->biYPelsPerMeter = 0
GetDIBits(memDC.m_hDC,bmp,0,pBInfo->biHeight,lpData,
(BITMAPINFO*)pBInfo,DIB_RGB_COLORS)