dlg2.cpp

来自「本事例:帮助理解MFC窗口通信全局变量的使用」· C++ 代码 · 共 58 行

CPP
58
字号
// dlg2.cpp : implementation file
//

#include "stdafx.h"
#include "testmb.h"
#include "dlg2.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// dlg2 dialog


dlg2::dlg2(CWnd* pParent /*=NULL*/)
	: CDialog(dlg2::IDD, pParent)
{
	//{{AFX_DATA_INIT(dlg2)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void dlg2::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(dlg2)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(dlg2, CDialog)
	//{{AFX_MSG_MAP(dlg2)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// dlg2 message handlers

void dlg2::OnButton1() 
{
	// TODO: Add your control notification handler code here
	
	CTestmbApp *app = (CTestmbApp *)AfxGetApp(); //生成指向应用程序类的指针 
	app->testStr = "dlg2::OnButton1()";
	
	MessageBox(app->testStr);
	
	


}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?