这是打开文件的代码void CReceptDBMSView::OnButtonOpen() 
{
// TODO: Add your control notification handler code here
CFileDialog dlg(TRUE,"rpt",NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
"Êվݴ浵(*.rpt)|*.rpt|ËùÓÐÎļþ(*.*)|*.*||",this); if(dlg.DoModal()==IDCANCEL)
return; CString filename=dlg.GetPathName();
CString str;
CFile file; if(file.Open(filename,CFile::modeReadWrite)==0)
{
str="´ò¿ªÎļþ "+filename+" Ê§°Ü!!!";
AfxMessageBox(str);
return;
}

CArchive ar(&file,CArchive::load);

if(this->m_ReceptsCount!=0)
{
this->m_pSet->MoveFirst();
while(!this->m_pSet->IsEOF())
{
this->m_pSet->Delete();
this->m_pSet->MoveNext();
}
}

ar.Close();
file.Close(); if(AfxGetApp()->OpenDocumentFile(filename)==NULL)
AfxMessageBox("´ò¿ªÓëÊվݴ浵ͬÃûµÄÎļþʧ°Ü!!!");}