Visual Studio 2005, C++, Windows XP.
I have a CDialog with a single button, which calls a function like so:
BEGIN_MESSAGE_MAP(Foo, BaseDlg) //BaseDlg inherits from CDialog ON_BN_CLICKED(IDBAR, Bar) END_MESSAGE_MAP()
The dialog box closes when its 'X' is clicked.
I change the above code to:
BEGIN_MESSAGE_MAP(Foo, BaseDlg) //BaseDlg inherits from CDialog ON_BN_CLICKED(IDBAR, Bar) ON_BN_CLICKED(IDBAZ, Baz) END_MESSAGE_MAP()
My dialog window will no longer close. Whenever the X is clicked, Baz() is called. The second ON_BN_CLICKED() handler is replacing the normal dialog close behavior for some reason.
How do I close a dialog box which has two or more buttons mapped to functions?