📄 rsetdoc.cpp
字号:
// RSetDoc.cpp : implementation of the CRSetDoc class
//
#include "stdafx.h"
#include "RSet.h"
#include "RSetDoc.h"
#include "fstream.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRSetDoc
IMPLEMENT_DYNCREATE(CRSetDoc, CLieDoc)
BEGIN_MESSAGE_MAP(CRSetDoc, CLieDoc)
//{{AFX_MSG_MAP(CRSetDoc)
ON_COMMAND(ID_FILE_CLOSE_ALL, OnFileCloseAll)
ON_UPDATE_COMMAND_UI(ID_FILE_CLOSE_ALL, OnUpdateFileCloseAll)
ON_UPDATE_COMMAND_UI(ID_OPEN_DATABASE, OnUpdateOpenDatabase)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRSetDoc construction/destruction
CRSetDoc::CRSetDoc()
{
}
CRSetDoc::~CRSetDoc()
{
}
/////////////////////////////////////////////////////////////////////////////
// CRSetDoc serialization
/////////////////////////////////////////////////////////////////////////////
// CRSetDoc diagnostics
#ifdef _DEBUG
void CRSetDoc::AssertValid() const
{
CLieDoc::AssertValid();
}
void CRSetDoc::Dump(CDumpContext& dc) const
{
CLieDoc::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CRSetDoc commands
BOOL CRSetDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
ifstream in;
in.open(lpszPathName); //读入文件
if(!in)
{
AfxMessageBox("文件不能打开!");
in.close();
CFileDialog dlg(TRUE);
if(dlg.DoModal()==IDOK )
{
CString filename=dlg.GetPathName();
in.open(filename);
// return false;
}
else return false;
}
if(! ReadFileHeader(in))
{
if(AfxMessageBox("用记事本打开文件吗?",MB_YESNO)==IDYES)
OpenWithNotepad(lpszPathName);
in.close();
return false;
}
char buf[256];
for(int i=0;i<m_iRecordNum;i++)
{
for(int j=0;j<m_iAttrNum+1;j++)
{
in>>buf;
if (stricmp(buf,"?")==0 || stricmp(buf,"-")==0||stricmp(buf,"*")==0)
{
m_bIsComplete=false;
break;
}
}
if(!m_bIsComplete)
break;
}
in.close();
return true;
}
BOOL CRSetDoc::SaveModified()
{
// return CLieDoc::SaveModified();
return true;
}
void CRSetDoc::OnFileCloseAll()
{
}
void CRSetDoc::OnUpdateFileCloseAll(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
}
void CRSetDoc::OnRsDiscrete()
{
// TODO: Add your command handler code here
}
void CRSetDoc::OnUpdateOpenDatabase(CCmdUI* pCmdUI)
{
pCmdUI->Enable(1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -