int iNewWidth = 2048; int iNewHeight = 2048; CImage image; image.Load(_T("C:\\Image.jpg")); CDC *screenDC = GetDC(); //Section that gives error CDC *pMDC = new CDC; pMDC->CreateCompatibleDC(screenDC); CBitmap *pb = new CBitmap; pb->CreateCompatibleBitmap(screenDC, iNewWidth, iNewHeight); CBitmap *pob = pMDC->SelectObject(pb); image.StretchBlt(pMDC->m_hDC,0, 0, iNewWidth, iNewHeight, 0, 0, image.GetWidth(), image.GetHeight(), SRCCOPY); pMDC->SelectObject(pob); CImage new_image; new_image.Attach((HBITMAP)(*pb)); new_image.Save(_T("c:\\NewImage.jpg")); new_image.Detach(); ReleaseDC(screenDC);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)