帮忙给看一下:下面的程序有什么错误?谢谢
它是用来读图片,然后再把图片显示出来?总报内存错
CFile file(lpFileName,CFile::modeRead|CFile::shareDenyWrite);
CArchive ar(&file,CArchive::load|CArchive::bNoFlushOnDelete);
CArchiveStream stream(&ar);
HRESULT hr = OleLoadPicture((IStream*)&stream, 0, FALSE, IID_IPicture, (void **)&m_pPic);
file.Close();
//Display
CDC *pDC=GetDC();
GetClientRect(&ShowRect);
long lWidth,lHeight;
m_pPic->get_Width((OLE_XSIZE_HIMETRIC*)&lWidth);
m_pPic->get_Height((OLE_YSIZE_HIMETRIC*)&lHeight);
CDC tempDC;
tempDC.CreateCompatibleDC(pDC);
CBitmap bmp;
bmp.CreateCompatibleBitmap(pDC,ShowRect.Width(),ShowRect.Height());
CBitmap *OldBmp=tempDC.SelectObject(&bmp);
m_pPic->Render(tempDC, 0, 0, ShowRect.Width(), ShowRect.Height(),
0, lHeight, lWidth, -lHeight, NULL);
m_pPic->Release();
pDC->BitBlt(ShowRect.left, ShowRect.top, ShowRect.Width(), ShowRect.Height(), &tempDC, 0, 0, SRCCOPY);
bmp.DeleteObject();