Link to home
Start Free TrialLog in
Avatar of Member_2_99151
Member_2_99151

asked on

How do I create a ON_BN_CLICK for a range of buttons in MFC?

I have an array of 64 buttons that I would like to respond to On Click.
How do I add a single handler to achieve this?

Thanks

James
ASKER CERTIFIED SOLUTION
Avatar of alb66
alb66
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The handler prototype is something like this:

void YourClass::memberFxn(UINT nID)
{
}
If, for any reason, the IDs of your buttons cannot be contiguos you must use this:

ON_BN_CLICKED( ID_BTN1, TheOnlyOneHandler )
ON_BN_CLICKED( ID_BTN2, TheOnlyOneHandler )
...
ON_BN_CLICKED( ID_BTNn, TheOnlyOneHandler )
Avatar of Member_2_99151
Member_2_99151

ASKER

Perfect! Thanks...