求救,unhandled exception 错误。
class CMainFrame : public CFrameWnd
{
protected: // create from serialization only
CMainFrame();
DECLARE_DYNCREATE(CMainFrame)
// Attributes
public:
SplitterWnd wndSplitter;
..........
};
void CMainFrame::Onsend()
{
// TODO: Add your command handler code here
//MessageBox("hello");
SplitterWnd &sw=wndSplitter;
sw.ChangeView(0,1,RUNTIME_CLASS(CRecsms));
}
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if (!wndSplitter.CreateStatic(this, 1, 2)) return false;
................
}
void SplitterWnd::ChangeView(int row, int col,CRuntimeClass* pViewClass)
{
ASSERT(pViewClass->IsDerivedFrom(RUNTIME_CLASS(CView)));
CView* pView = STATIC_DOWNCAST(CView, GetPane(row, col));
CFrameWnd* pFrame = pView->GetParentFrame();
ASSERT(pFrame);
// set up create context to preserve doc/frame etc.
CCreateContext cc;
memset(&cc, 0, sizeof(CCreateContext));
cc.m_pNewViewClass = pViewClass;
cc.m_pCurrentDoc = pView->GetDocument();
cc.m_pNewDocTemplate = cc.m_pCurrentDoc ?
cc.m_pCurrentDoc->GetDocTemplate() : NULL;
cc.m_pCurrentFrame = pFrame;
DeleteView(row, col); // delete old view
VERIFY(CreateView(row, col, // create new one
pViewClass,
CSize(0,0), // will fix in RecalcLayout
错误发生处: &cc));
// delete &cc;
RecalcLayout(); // recompute layout
// initialize the view
CWnd* pWnd = GetPane(row, col);
if (pWnd)
pWnd->SendMessage(WM_INITIALUPDATE);
}
我把窗口分割成左右两个,通过void CMainFrame::Onsend() 切换右边视图窗口,其中SplitterWnd::ChangeView(int row, int col,CRuntimeClass* pViewClass)是从另外的工程复制过来的,并且在那里运行良好。为什么在我这里运行到“错误发生处:”就出现
Unhandled exception in 文件名.exe(MFC42D.DLL):0x0000005 Access Violation?有什么办法可以解决?谢谢先!!
相关推荐
关于Unhandled event loop exception No more handles的两种解决方案
在使用eclipse的时候,有时候会弹出一个方框,里面的内容是Unhandled event loop exception No more handles,当你点击OK的时候,又会出来一个方框,里面第一句话是 An SWT error has occurred,并且诱导你关闭eclipse,严重影响了我们对eclipse的使用。本人就是遇到这样的问题,百度了大量资料没有解决,后来自己摸索整理了两套方法,写在附件里,供大家使用,希望能帮大家解决这个棘手的问题。
2021-Unhandled-Exception:未处理的异常
Sitecore Hackathon 2021 必须阅读: ⟹<<
snmp Unhandled exception(NTDLL.DLL):0xC0000005
在snmp++的MFC编程中,调试运行到Snmp snmp(status,0,false);语句时总是出现这个错误。Unhandled exception in xxx.exe(NTDLL.DLL):0xC0000005:Access Volation该怎么解决呢?
解决MAX-VR渲染跳出及弹出UNHANDLED EXCEPTION内存分配失败.docx
解决MAX-VR渲染跳出及弹出UNHANDLED EXCEPTION内存分配失败.docx解决MAX-VR渲染跳出及弹出UNHANDLED EXCEPTION内存分配失败.docx
出现报错An unhandled exception occurred while processing the request
下载装好了,能用,立即上传,有需要自己下载 RedisConnectionException: It was not possible to connect to the redis server(s). UnableToConnect on 127.0.0.1:6379 下载装一下 看下这位博主的文章 https://blog.csdn.net/qq_48148522/article/details/141441216


