modellessdialog.cpp
来自「一些VC++的经典实例」· C++ 代码 · 共 80 行
CPP
80 行
// ModellessDialog.cpp : implementation file
//
#include "stdafx.h"
#include "ex18.h"
#include "ModellessDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMoellessDlg dialog
CMoellessDlg::CMoellessDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMoellessDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMoellessDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_pView = NULL;
}
CMoellessDlg::CMoellessDlg(CView* pView) // modeless constructor
{
m_pView = pView;
}
BOOL CMoellessDlg::Create()
{
return CDialog::Create(CMoellessDlg::IDD);
}
void CMoellessDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMoellessDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMoellessDlg, CDialog)
//{{AFX_MSG_MAP(CMoellessDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMoellessDlg message handlers
void CMoellessDlg::OnOK()
{
// TODO: Add extra validation here
if (m_pView != NULL) {
// modeless case -- do not call base class OnOK
UpdateData(TRUE);
m_pView->PostMessage(WM_GOODBYE, IDOK);
}
else
{
CDialog::OnOK();
}
}
void CMoellessDlg::OnCancel()
{
// TODO: Add extra cleanup here
if (m_pView != NULL) {
// modeless case -- do not call base class OnCancel
m_pView->PostMessage(WM_GOODBYE, IDCANCEL);
}
else
{
CDialog::OnCancel();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?