1:
::GetDIBits(pDC->GetSafeHdc(),bm,0,nHeight,gray,m_pBitmapInfo,DIB_RGB_COLORS);
bm是 pDC中所选择的位图的m_hObject,gray是保存数据的缓冲区,
m_pBitmapInfo是已经填充好必要数据,infoheader中的前六个重要参数
bitmapInfo.biBitCount=24;
bitmapInfo.biHeight=h;
bitmapInfo.biWidth=w;
bitmapInfo.biSize=sizeof(BITMAPINFOHEADER);
bitmapInfo.biCompression=0;
bitmapInfo.biPlanes=1;
2:使用CImage类
CImage::Attach(hdc);
aaaaa.Save(_T("A.bmp"),Gdiplus::ImageFormatPNG);