3
: . /
1.
2. /
, Windows , (event-driven). , (message loop), ( 䳿), Windows. , ( (message handler) , ). . WM_QUIT. ? "" MFC ,
CWnd::RunModalLoop, thrdcore. cpp. - . , . .
for (;;), .
for while, , (idle). , MFC ( ) , . , while bldle ', , . , , PeekMessage, 0, . , bldle 1 , , , .
(do) . (message loop), (message pump), . , ContinueModal ( , ) WM_QUIT ( AfxPurapMessage 0). , . .
, MFC, MFC, , , Windows, . ? 䳿 , , , . (message map) , BN_CLICKED OnBnClickedOk. , HelloDialogDlg.cpp , BEGIN MESSAGE_MAP. :
|
|
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
ON_BN_CLICKED(IDOK, OnBnClickedOk)
END MESSAGE MAP()
MFC , , ' , , . MFC, BEGINMESSAGEMAP, ³ (Scot Wingo) MFC Internals.
䳿, (GUI Graphical User Interface). BN_CLICKED : . , ? , 䳿 ? , , , 볺 .
1. ³ Class View ().
2. , , . CHelloDialogDlg.
3. , ', Properties ().
4. Properties () Messages () ( ). ³ . , , .
5. WM_LBUTTONDBLCLK. , ' . , , . (. 1.21) WM_LBUTTONDBLCLK ( ), " ". , , , ' .
, 䳿. 䳿 , <Add> OnLButtonDblClk (<> OnLButtonDblClk).
7. , Visual Studio - ' CHelloDialogDlg:: OnLButtonDblClk, , WM_LBUTTONDBLCLK . .
|
|
. 1.21. ij Properties
8. - OnLButtonDblClkTaK, :
void CHelloDialogDlg::OnLButtonDblClk(UINT nFlags, CPoint point) {
AfxMessageBox("Ouch! Don't touch me there!");
CDialog::OnLButtonDblClk(nFlags, point);
}
9. ³ , , 볺 ' .
, - . , , . ? (function prototype) , (function definition) . . . Properties (). WM_LBUTTONDBLCLK , , , . , 䳿 .
Properties, . Visual Studio ClassWizard, , , .
ij Properties 䳿 .