I have this error in atlimage.h line 1568 while trying to save picture. In release mode everything is "fine" but no new file appears. Here is the code:
CClientDC dc(this);
CDC dcMem;
CBitmap m_bmpBack;
GetClientRect(&rc);
hBmp = LoadImage(NULL,name,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
GetObject ( hBmp, sizeof(bm), &bm );
m_bmpBack.Attach(hBmp);
dcMem.CreateCompatibleDC(&dc);
hbmpOld = (HBITMAP)dcMem.SelectObject(m_bmpBack);
//hToSave = (HBITMAP)hBmp;
//hToSave = (HBITMAP)m_bmpBack;
//hToSave = (HBITMAP)dcMem.SelectObject(m_bmpBack);
hToSave = (HBITMAP)dcMem.GetCurrentBitmap(); //I tried each of them, all the same result(
dc.StretchBlt(rc.left, rc.top, rc.right, rc.bottom,&dcMem, 0, 0, (int)bm.bmWidth, (int)bm.bmHeight, SRCCOPY);
CImage myImage;
if (hToSave!=NULL)
{
myImage.Attach(hToSave);
myImage.Save(L"d:/image3.jpg");
}
else
{
name = L"d:/backgrnd.bmp";
}
What I have to add or remove to make this work?