16,471
社区成员
发帖
与我相关
我的任务
分享
class CNewDlg : public CDialog
{
// Construction
public:
CNewDlg(UINT nID, CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CNewDlg)
// enum { IDD = IDD_DIALOG1 };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNewDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CNewDlg)
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
---------------------------------------------------------------
CNewDlg::CNewDlg(UINT nID, CWnd* pParent /*=NULL*/)
: CDialog(nID, pParent)
{
//{{AFX_DATA_INIT(CNewDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CNewDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CNewDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CNewDlg, CDialog)
//{{AFX_MSG_MAP(CNewDlg)
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CNewDlg message handlers
void CNewDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
AfxMessageBox(_T("new1"));
CDialog::OnLButtonDown(nFlags, point);
}
--------------------------------------------------------------------
----------------------------------------------------------------------
#include "NewDlg.h"
class CNewDlg2 : public CNewDlg
{
// Construction
public:
CNewDlg2(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CNewDlg2)
enum { IDD = IDD_DIALOG2 };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNewDlg2)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CNewDlg2)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
------------------------------------------------------------------------
CNewDlg2::CNewDlg2(CWnd* pParent /*=NULL*/)
: CNewDlg(CNewDlg2::IDD,pParent)
{
//{{AFX_DATA_INIT(CNewDlg2)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CNewDlg2::DoDataExchange(CDataExchange* pDX)
{
CNewDlg::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CNewDlg2)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CNewDlg2, CNewDlg)
//{{AFX_MSG_MAP(CNewDlg2)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CNewDlg2 message handlers
-------------------------------------------------
----------------------------------------------
//调用
CNewDlg2 dlg;
dlg.DoModal();
// CNewDlg的H文件
class CNewDlg : public CDialog
{
// Construction
public:
CNewDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CNewDlg)
enum { IDD = IDD_DIALOG1 };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNewDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CNewDlg)
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
// CNewDlg的CPP文件
CNewDlg::CNewDlg(CWnd* pParent /*=NULL*/)
: CDialog(CNewDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CNewDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CNewDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CNewDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CNewDlg, CDialog)
//{{AFX_MSG_MAP(CNewDlg)
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CNewDlg message handlers
void CNewDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
AfxMessageBox(_T("Hello"));
CDialog::OnLButtonDown(nFlags, point);
}
------------------------------------------------------------------
// CNewDlg2继承了CNewDlg类
#include "NewDlg.h"
// CNewDlg2的H文件
class CNewDlg2 : public CNewDlg
{
// Construction
public:
CNewDlg2(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CNewDlg2)
enum { IDD = IDD_DIALOG1 };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNewDlg2)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CNewDlg2)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
// CNewDlg2的CPP文件
CNewDlg2::CNewDlg2(CWnd* pParent /*=NULL*/)
: CNewDlg(pParent)
{
//{{AFX_DATA_INIT(CNewDlg2)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CNewDlg2::DoDataExchange(CDataExchange* pDX)
{
CNewDlg::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CNewDlg2)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CNewDlg2, CNewDlg)
//{{AFX_MSG_MAP(CNewDlg2)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CNewDlg2 message handlers
--------------------------------------------------------------------------------
//调用:
CNewDlg2 dlg;
dlg.DoModal();