-
大小: 19KB文件類型: .rar金幣: 2下載: 0 次發(fā)布日期: 2021-05-21
- 語言: C/C++
- 標(biāo)簽: mfc??消息響應(yīng)??windows??
資源簡介
通常我們都是使用MFC的資源視圖在對話框或FormView上通過拖拽的方式添加按鈕,這里我們利用CButton對象來動態(tài)創(chuàng)建按鈕,并對按鈕添加單擊消息響應(yīng)。如果你有任何疑問,歡迎和我討論。

代碼片段和文件信息
//?DBN.cpp?:?Defines?the?class?behaviors?for?the?application.
//
#include?“stdafx.h“
#include?“DBN.h“
#include?“DBNDlg.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//?CDBNApp
BEGIN_MESSAGE_MAP(CDBNApp?CWinApp)
//{{AFX_MSG_MAP(CDBNApp)
//?NOTE?-?the?ClassWizard?will?add?and?remove?mapping?macros?here.
//????DO?NOT?EDIT?what?you?see?in?these?blocks?of?generated?code!
//}}AFX_MSG
ON_COMMAND(ID_HELP?CWinApp::onhelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//?CDBNApp?construction
CDBNApp::CDBNApp()
{
//?TODO:?add?construction?code?here
//?Place?all?significant?initialization?in?InitInstance
}
/////////////////////////////////////////////////////////////////////////////
//?The?one?and?only?CDBNApp?object
CDBNApp?theApp;
/////////////////////////////////////////////////////////////////////////////
//?CDBNApp?initialization
BOOL?CDBNApp::InitInstance()
{
AfxEnableControlContainer();
//?Standard?initialization
//?If?you?are?not?using?these?features?and?wish?to?reduce?the?size
//??of?your?final?executable?you?should?remove?from?the?following
//??the?specific?initialization?routines?you?do?not?need.
#ifdef?_AFXDLL
Enable3dControls(); //?Call?this?when?using?MFC?in?a?shared?DLL
#else
Enable3dControlsStatic(); //?Call?this?when?linking?to?MFC?statically
#endif
CDBNDlg?dlg;
m_pMainWnd?=?&dlg;
int?nResponse?=?dlg.DoModal();
if?(nResponse?==?IDOK)
{
//?TODO:?Place?code?here?to?handle?when?the?dialog?is
//??dismissed?with?OK
}
else?if?(nResponse?==?IDCANCEL)
{
//?TODO:?Place?code?here?to?handle?when?the?dialog?is
//??dismissed?with?Cancel
}
//?Since?the?dialog?has?been?closed?return?FALSE?so?that?we?exit?the
//??application?rather?than?start?the?application‘s?message?pump.
return?FALSE;
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件??????35244??2012-08-26?18:58??DBN\DBN.APS
?????文件???????1001??2012-08-26?19:14??DBN\DBN.clw
?????文件???????2021??2012-08-26?18:58??DBN\DBN.cpp
?????文件???????4109??2012-08-26?19:14??DBN\DBN.dsp
?????文件????????529??2012-08-26?18:58??DBN\DBN.dsw
?????文件???????1291??2012-08-26?18:58??DBN\DBN.h
?????文件???????5146??2012-08-26?18:58??DBN\DBN.rc
?????文件???????4405??2012-08-26?19:14??DBN\DBNDlg.cpp
?????文件???????1376??2012-08-26?19:14??DBN\DBNDlg.h
?????文件???????3525??2012-08-26?18:58??DBN\ReadMe.txt
?????文件???????1078??2012-08-26?18:58??DBN\res\DBN.ico
?????文件????????395??2012-08-26?18:58??DBN\res\DBN.rc2
?????文件????????528??2012-08-26?18:58??DBN\Resource.h
?????文件????????205??2012-08-26?18:58??DBN\StdAfx.cpp
?????文件???????1054??2012-08-26?18:58??DBN\StdAfx.h
?????目錄??????????0??2012-08-26?18:58??DBN\res
?????目錄??????????0??2012-08-26?19:16??DBN
-----------?---------??----------?-----??----
????????????????61907????????????????????17
評論
共有 條評論