sdi框架中 mainfrm类 弹出的模式对话框 里想找到Doc的指针 执行操作CMainFrame *pFrame = (CMainFrame*)(AfxGetApp()->m_pMainWnd);
CRecentFileDemoDoc* pDoc = (CRecentFileDemoDoc*)(pFrame->GetActiveDocument());出现错误pFrame句柄为0
为什么呢
CRecentFileDemoDoc* pDoc = (CRecentFileDemoDoc*)(pFrame->GetActiveDocument());出现错误pFrame句柄为0
为什么呢
CMainFrame *pFrame = (CMainFrame*)(AfxGetMainWnd());
CRecentFileDemoDoc* pDoc = (CRecentFileDemoDoc*)(pFrame->GetActiveDocument());pDoc又非法了 晕
Unhandled exception at 0x00dd4b15 in RecentFileDemo.exe: 0xC0000005: Access violation writing location 0xdd50f000.然后程序断在objcore.cpp文件的
if (!AfxIsValidAddress(pOb, pOb->GetRuntimeClass()->m_nObjectSize, FALSE))处
AfxGetMainWnd()->GetActiveView()->GetDocument();
mainfrm.cpp下domodule一个对话框a a下面某个操作后(此时a未销毁) 想写一个数据于是想找pDoc指针
现在改成全局变量 就好了