出错时调用堆栈的信息: GdiPlus.dll!4aeff800() [下面的框架可能不正确和/或缺失,没有为 GdiPlus.dll 加载符号] GdiPlus.dll!4af39703() 指向: Status DrawImage(IN Image* image, IN INT x, IN INT y, IN INT width, IN INT height) { return SetStatus(DllExports::GdipDrawImageRectI(nativeGraphics, image ? image->nativeImage : NULL, x, y, width, height)); }
出错时查看调用堆栈,找出引起错误的代码,看看哪个指针是NULL。
GdiPlus.dll!4aeff800()
[下面的框架可能不正确和/或缺失,没有为 GdiPlus.dll 加载符号]
GdiPlus.dll!4af39703() 指向:
Status DrawImage(IN Image* image,
IN INT x,
IN INT y,
IN INT width,
IN INT height) {
return SetStatus(DllExports::GdipDrawImageRectI(nativeGraphics,
image ? image->nativeImage
: NULL,
x,
y,
width,
height));
}
你看看是不是IN Image* image这个参数为NULL了?
CFileDialog dlg(TRUE,NULL,NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
_T("图片文件(*.jpg;*.jpeg;*.gif;*.bmp)|*.jpg;*.jpeg;*.gif;*.bmp|位图文件(*.BMP)|*.BMP|JPEG文件(*.JPG)|*.JPG|GIF文件(*.GIF)|*.GIF||"));
if (IDOK==dlg.DoModal())
{
isfileopen=TRUE;
count=0;
num2++;
biggernum=1.0;
isPicBeDelete=FALSE;
isPicBeRotate=FALSE;
isPicBeBigOrSmall=FALSE;
hasbemove=FALSE;//是否已经被移动
hasbecut=FALSE;//是否已经被剪切
hasberename=FALSE;//是否已经重命名
CRect rect;
GetClientRect(&rect);
width=rect.Width();
height=rect.Height();
strPicPath.Format(_T("%s"),dlg.GetPathName());
CFile::GetStatus(dlg.GetPathName(),filestatu);
bitmap=new Bitmap(ToWChar((PSTR)(LPCSTR)strPicPath));
widthtemp1=bitmap->GetWidth();
heighttemp1=bitmap->GetHeight();
CMainFrame* pmain24=(CMainFrame*)AfxGetMainWnd();
pmain24->isstetch=FALSE;
// Bitmap tmp(ToWChar((PSTR)(LPCSTR)strPicPath));
//Bitmap* tmp =bitmap->clone(0,0,widthtemp,heighttemp,PixelFormatDontCare); //重新复制一份
filename.Format(_T("%s"),dlg.GetFileName());
// AfxMessageBox(filename);
strPicFolder=strPicPath.Left(strPicPath.GetLength()-filename.GetLength());
// if(strPicPath!="")
// {isPicBeDelete=FALSE;}
extname = dlg.GetFileExt(); //返回选定文件的扩展文件名
extname.MakeLower(); //将后缀名变成小写的
Invalidate();//通知重绘
}
}下面为OnDraw里面的代码:
if(ispicture && !isPicBeDelete && !hasbemove && !hasbecut && !hasberename && !hasbecopy)//没有被删除.移动,剪切,重命名
{
//绘图到屏幕
if(isfileopen)
{
widthtemp=widthtemp1*254/(GetDeviceCaps(pDC->m_hDC,LOGPIXELSX)*10);
heighttemp=heighttemp1*254/(GetDeviceCaps(pDC->m_hDC,LOGPIXELSY)*10);
}Rect rect(5.0f,5.0f,widthtemp,heighttemp); //起始点
graphics.ScaleTransform(biggernum,biggernum);graphics.DrawImage(bitmap,rect);
}
红色部分出错..
反过来说,如果在其他机器上是未打补丁,就还可能出错。
方便的话就在同一目录下带上最新的gdiplus.dll吧。qq就是这么干的