Re: ON_BN_CLICKED not working
Issue resolved. Thanks.
On Nov 30, 6:11 pm, Joseph M. Newcomer <newco...@flounder.com> wrote:
See below...
On Sat, 29 Nov 2008 20:34:22 -0800 (PST), "aloha...@gmail.com" <aloha...@=
gmail.com> wrote:
Hi
I created MFC AppWizard (exe) -> Single Document
****
Using what version of VS?
****>From the program subMenu, I trigger a small dialog screen IDD_DIALOG=
1
In the dialog screen, I put one button control.
****
The first thing you would do is change the name from IDD_DIALOG1 to somet=
hing that makes
sense
****
The messageMap contains the correct messages and the functions names
and all that are correct.
I have added the events to a class connected to the dialog, and also
the Control class, but still the same result.
BEGIN_MESSAGE_MAP(MyDialog, CDialog)
//{{AFX_MSG_MAP(MyDialog)
ON_BN_CLICKED(IDC_BtnConnect, OnBtnConnect)
*****
Is this the correct ID of the control?
*****> ON_WM_CLOSE()
ON_WM_PAINT()
****
You would not want or need an OnPaint handler. Why do you have one?
****> //}}AFX_MSG_MAP
END_MESSAGE_MAP()
void MyDialog::OnBtnConnect()
{
AfxMessageBox("Hello world", MB_OK|MB_ICONSTOP);
****
ALWAYS put whitespace around binary operators like "|". Otherwise your co=
de is unreadable.
The correct form is
AfxMessageBox(_T(:"Hello world"), MB_OK | MB_ICONSTOP);
don't forget the _T() around string literals.
****
}
Do you know how to solve this ?
****
Solve what? I don't see a problem statement here. I don't see a des=
cription of what is
going on, such as are you invoking a modal or modeless dialog? I've ne=
ver seen this fail,
so there's something really weird going on.
*****
Is it because of ActiveX Dialog ?
*****
What's ActiveX Dialog? I have no clue what you are talking about here.=
You clearly have
a class derived from CDialog, with a button on it, so what does ActiveX h=
ave to do with
anything?
joe
****
Regards.
Joseph M. Newcomer [MVP]
email: newco...@flounder.com
Web:http://www.flounder.com
MVP Tips:http://www.flounder.com/mvp_tips.htm