㊣㊣ 急,请问,基于 D/V 结构的程序中,为什么在一个无模式对话框中获得当前活动文档的某个数组后,在对话框中只要操作该数组,程序就挂
clh 2003-10-20 02:08:09 非常急!!!
我写了一个基于 Document/View 的程序。 在doc 的opendocument中 最后打开一个创建的对话框,如下:
BOOL CDbmsDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
if (!CDocument::OnOpenDocument(lpszPathName))
return FALSE;
// TODO: Add your specialized creation code here
CBiaoDlg* pbiao=new CBiaoDlg;
pbiao->Create(BIAO,NULL);
pbiao->ShowWindow(SW_SHOW);
pbiao->GetNumber();
return TRUE;
}
我的CBiaoDlg 是一个对话框。 它的getnumber函数如下:
void CBiaoDlg::GetNumber()
{
CMainFrame* pframe=(CMainFrame* )AfxGetApp()->m_pMainWnd;
CDbmsDoc* pdoc=(CDbmsDoc* )pframe->GetActiveDocument();
int count=0;
CTypedPtrList<CObList,CStroke* >& strokelist=pdoc->m_strokelist;
POSITION pos=strokelist.GetHeadPosition();
while(pos!=NULL)
{
CStroke* ps=strokelist.GetNext(pos);
for(int i=0;i<ps->m_stringarray.GetSize();i++)
{
CString tmep=ps->m_stringarray.GetAt(count);
m_list.SetItemText(count,i+1,tmep);
}
count++;
}
}
cstroke是一个具有serialize的新类。 不知道为什么。 程序编译是没什么问题的,只不过运行的时候就挂了。不过数据是可以显示出来的, 刚刚显示完,程序就发生错误挂了。
不知道这是为什么。希望高手指教。 谢谢。