使用了GetDC,就需要ReleaseDC();
HBITMAP hbmp = (HBITMAP)tempbitmap.Detach();
以下暂存
// int size = hbmp.bmWidth * hbmp.bmWidthBytes;
// unsigned char * pBits = (unsigned char *)malloc(size);
// GetBitmapBits(hbmp,size,pBits);
HBITMAP hBitmapDst;
hBitmapDst = (HBITMAP)m_dibM.DDBToDIB((HBITMAP)hbmp,BI_RGB, NULL);
if( hBitmapDst )
{
(void)m_dibM.WriteDIB("temp.bmp", hBitmapDst,rcCrop);
}
CImage imgDst;
imgDst.Load("temp.bmp");
if(!imgTemp.IsNull())
{
imgTemp.Destroy();
}
// imgTemp.Load("temp.bmp");
ImageCopy(imgDst,imgTemp,rcCrop);
imgTemp.Save("temp2.bmp");
m_img.Create(imgTemp.GetWidth(),imgTemp.GetHeight(),32);
// imageTemp.Save("test.jpg");
// m_img.SetStretchBltMode(HALFTONE);
// imageTemp.StretchBlt(m_img.GetDC(),0,0,rect.right,rect.bottom,rect.right,rect.bottom,-rect.right,-rect.bottom);