我把代码修改了一下,你再看看能否打开文件.
保存文件也象上面一样,不过稍微复杂点.
在另存为事件中把此代码加入,
并且把OnOpenDocument修改成OnSaveDocument.
还要把
CFileDialog fileDlg(TRUE, _T("*.dvp"), NULL, OFN_FILEMUSTEXIST | OFN_HIDEREADONLY |
OFN_NONETWORKBUTTON | OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT, szFilter, NULL);
修改成
CFileDialog fileDlg(FALSE, _T("*.dvp"), NULL, OFN_FILEMUSTEXIST | OFN_HIDEREADONLY |
OFN_NONETWORKBUTTON | OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT, szFilter, NULL);
在保存事件中加入此代码
去掉CFileDialog fileDlg(TRUE, _T("*.dvp"), NULL, OFN_FILEMUSTEXIST | OFN_HIDEREADONLY |
OFN_NONETWORKBUTTON | OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT, szFilter, NULL);
并且要判断文件是否修改,这些我就不用多说了.