📄 testdialogdoc.cpp
字号:
// TestDialogDoc.cpp : implementation of the CTestDialogDoc class
//
#include "stdafx.h"
#include "TestDialog.h"
#include "TestDialogDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTestDialogDoc
IMPLEMENT_DYNCREATE(CTestDialogDoc, CDocument)
BEGIN_MESSAGE_MAP(CTestDialogDoc, CDocument)
//{{AFX_MSG_MAP(CTestDialogDoc)
ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
ON_COMMAND(ID_FILE_SAVE_AS, OnFileSaveAs)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTestDialogDoc construction/destruction
CTestDialogDoc::CTestDialogDoc()
{
// TODO: add one-time construction code here
}
CTestDialogDoc::~CTestDialogDoc()
{
}
BOOL CTestDialogDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CTestDialogDoc serialization
void CTestDialogDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CTestDialogDoc diagnostics
#ifdef _DEBUG
void CTestDialogDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CTestDialogDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CTestDialogDoc commands
void CTestDialogDoc::OnFileOpen()
{
CFileDialog dlg(TRUE);
int ret=dlg.DoModal();
if(ret==IDOK)
{
CString pathName=dlg.GetPathName();
CString fileName=dlg.GetFileName();
char tbuf[120];
sprintf(tbuf,"The %s file in %s is opened!",
fileName,pathName);
AfxMessageBox(tbuf);
}
}
void CTestDialogDoc::OnFileSaveAs()
{
CFileDialog dlg(FALSE);
int ret=dlg.DoModal();
if(ret==IDOK)
{
CString pathName=dlg.GetPathName();
CString fileName=dlg.GetFileName();
char tbuf[120];
sprintf(tbuf,"The %s file in %s is saved!",
fileName,pathName);
AfxMessageBox(tbuf);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -