一个关于响应CPropertySheet “OK”按钮(确认)按钮的方法试验

来源:互联网 发布:linux vim 复制 编辑:程序博客网 时间:2024/05/16 08:36
1. Add this to the property sheet's structure.
: : // Generated message map functions
: protected:
: //{{AFX_MSG(CMyPropertySheet)
: // NOTE - the ClassWizard will add and remove member functions here.
: afx_msg void OnOK();
: //}}AFX_MSG
: DECLARE_MESSAGE_MAP()
: };


: 2. Add a message map for the OnOK event handler in the property sheet's *.cpp file.
: : BEGIN_MESSAGE_MAP(CMyPropertySheet, CPropertySheet)
: //{{AFX_MSG_MAP(CMyPropertySheet)
: // NOTE - the ClassWizard will add and remove mapping macros here.
: ON_COMMAND(IDOK, OnOK)
: //}}AFX_MSG_MAP
: END_MESSAGE_MAP()



: 3. Now just add the event handler itself. This one just displays something.
: : void CMyPropertySheet::OnOK()
: {
: AfxMessageBox("Hello World");
: CPropertySheet::OnClose();
: }




That last function should have looked like this:
void CMyPropertySheet::OnOK()
{
AfxMessageBox("Hello World");
CPropertySheet::EndDialog(IDOK);

}
原创粉丝点击