a CBaseDlg based on CDialog
Env: XP, VC++6.00
I have many dialog boxes which have a same feature: All of these dialogs
have a button named "setting information". To avoid handling these buttons
one by one, I make a CBaseDlg based on CDialog as follows,
class CBaseDlg : public CDialog
{
public:
CBaseDlg(UINT ID, CWnd* pParent = NULL);
protected:
virtual void DoDataExchange(CDataExchange* pDX);
protected:
CButton m_btn;
virtual BOOL OnInitDialog();
afx_msg void OnBtnSettingInf();
}
BEGIN_MESSAGE_MAP(CBaseDlg, CDialog)
ON_BN_CLICKED(IDC_BTNSETTINGINF, OnBtnSettingInf)
END_MESSAGE_MAP()
BOOL CBaseDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_btn.Create( "setting information",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP,
CRect(1,1,100,30),
this,
IDC_BTNSETTINGINF);
return TRUE;
}
void CBaseDlg::OnBtnSettingInf()
{
CSettingInformation dlg;
dlg.DoModal();
}
If I use CBaseDlg to create a dialog(IDD = IDD_DIALOG1), the button is
showed on IDD_DIALOG1. But when I push the button,
CBaseDlg::OnBtnSettingInf() is not called.
How to make it work?
TIA
ou