Click to See Complete Forum and Search --> : get the window message?


sayoyo
May 10th, 1999, 03:37 PM
Hi,

If I create a button dynamically with MFC like this:

RECT r;
r.bottom = 30;
r.left = 10;
r.right = 60;
r.top = 10;

pNewButton = new CButton;
pNewButton->Create("toto",WS_VISIBLE,r,AfxGetMainWnd(),1001);

and after when i click on the created button, I would like it show a message box. But I don't how to associate the click buttom message with the correct method of the created buttom.

Thanks

koko
May 10th, 1999, 05:03 PM
U should create a CButton derived class for the new button and using Attach function the attach your new button to this CButton derived class.
eg. CMyButton btn;
btn.Attach(MyButtonHandle);