unhandled exception in SARView.exe(ZSDDM.DLL): 0xC0000005: Access Violation

liumenghappy 2009-10-08 09:45:13
程序运行到dcPrint.EndDoc(),就会报错误:
unhandled exception in SARView.exe(ZSDDM.DLL): 0xC0000005: Access Violation
应该是越界或空指针,这种错误应该怎样调试呢?
...全文
528 44 打赏 收藏 转发到动态 举报
写回复
用AI写文章
44 条回复
切换为时间正序
请发表友善的回复…
发表回复
wjcapple 2009-10-30
  • 打赏
  • 举报
回复
问题解决了没有?我也遇到相似的问题
liumenghappy 2009-10-12
  • 打赏
  • 举报
回复
恩,谢谢你,我再看看
twins222 2009-10-12
  • 打赏
  • 举报
回复
应该是你那几个指针的问题,希望你快点解决 帮顶
liumenghappy 2009-10-12
  • 打赏
  • 举报
回复
顶起来
liumenghappy 2009-10-12
  • 打赏
  • 举报
回复
因为pPrintView 要用到主窗口的参数,所以就在CPrintView 中加了一个窗口指针
现在去掉了,不过还是有错误
twins222 2009-10-12
  • 打赏
  • 举报
回复
pPrintView->m_pDlg=this; 是干啥的?去掉不行吗?
liumenghappy 2009-10-12
  • 打赏
  • 举报
回复
[Quote=引用 37 楼 twins222 的回复:]
CPrintView *pPrintView = (CPrintView*)pFrameWnd->GetActiveView(); 改为CPrintView *pPrintView = (CPrintView*)(pFrameWnd->GetActiveView()); 试试,虽然不见得对,你试一下看看呵呵
[/Quote]
试了一下,效果还是一样的
twins222 2009-10-12
  • 打赏
  • 举报
回复
CPrintView *pPrintView = (CPrintView*)pFrameWnd->GetActiveView(); 改为CPrintView *pPrintView = (CPrintView*)(pFrameWnd->GetActiveView()); 试试,虽然不见得对,你试一下看看呵呵
liumenghappy 2009-10-12
  • 打赏
  • 举报
回复
系统崩溃时先出现对话框:
"0x0c1b3bad"指令引用的"0x0d5b91f0"内存,该内存不能为"read"。
然后跳出对话框:
unhandled exception in SARView.exe(ZSDDM.DLL): 0xC0000005: Access Violation
liumenghappy 2009-10-12
  • 打赏
  • 举报
回复
[Quote=引用 34 楼 twins222 的回复:]
你看看CPrintView *pPrintView = (CPrintView*)pFrameWnd->GetActiveView(); 里面的pFrameWnd或者pPrintView是不是空的。把(CPrintView*)改成(CFrameWnd*)试试呢
[/Quote]检查过了,pFrameWnd或者pPrintView都不是空的
twins222 2009-10-12
  • 打赏
  • 举报
回复
你看看CPrintView *pPrintView = (CPrintView*)pFrameWnd->GetActiveView(); 里面的pFrameWnd或者pPrintView是不是空的。把(CPrintView*)改成(CFrameWnd*)试试呢
liumenghappy 2009-10-12
  • 打赏
  • 举报
回复
[Quote=引用 32 楼 yangjinming8888 的回复:]
OnFilePrint()  函数设为public
[/Quote]
OnFilePrint本身就是public,不然不能调用的
我觉得是某个指针没有分配内存,然后去访问该指针造成内存不能read
可是就是找不到是哪个指针,也可能是资源文件ID的问题
yangjinming8888 2009-10-12
  • 打赏
  • 举报
回复
OnFilePrint() 函数设为public
liumenghappy 2009-10-12
  • 打赏
  • 举报
回复
注释掉就没错误了
雪影 2009-10-12
  • 打赏
  • 举报
回复
pPrintView->OnFilePrint();//此处调用CView::OnFilePrint();
将这一行代码注释掉还会报错吗?
liumenghappy 2009-10-12
  • 打赏
  • 举报
回复
功夫不负有心人!
liumenghappy 2009-10-11
  • 打赏
  • 举报
回复
再顶
jingss_3 2009-10-11
  • 打赏
  • 举报
回复
帮顶
liumenghappy 2009-10-10
  • 打赏
  • 举报
回复
[Quote=引用 17 楼 hcyang 的回复:]
CPrintView::OnPrint的代码是什么样的?
[/Quote]
问题应该不在CPrintView::OnPrint,因为我把OnPrint代码全部注销,同样会报错的
hcyang 2009-10-10
  • 打赏
  • 举报
回复
CPrintView::OnPrint的代码是什么样的?
加载更多回复(24)

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧