Link to home
Start Free TrialLog in
Avatar of Hanqian
Hanqian

asked on

How to let buttons work on PropertyPage?

I have a propertyPage and I put a "Button" on it and I also implement
function: OnButton(), when I click this button, it should
popup another dialog, but there is nothing happens when it is clicked.
When I put the MessageBox at first line of this function, when I click
the "Button", still there is no any reaction, how to get command message
when you click button on propertyPage? Urgent!!

Hanqian.
Thanks.
Avatar of abelblaine111
abelblaine111

If you are using MFC then you can do this.. Delete what you have then go to the class wizard.
Select the class that has the button.
Go to Message Maps tab.
In Object ID's select the button ID.
Click on the message you wand to add.
Click on the Add Function Button.

That will do it.

If you arent using MFC, or you want to hand add the handlers do this.

in the .h of the class that has the button add this to the protected section.

afx_msg void OnMyFunction();

then in the .c/.cpp

BEGIN_MESSAGE_MAP(CMyClass, CDialog)
   ON_BN_CLICKED(IDOFYOURBUTTON, OnMyFunction)

END_MESSAGE_MAP()

In the property Page the BEGIN_MESSAGE_MAP will have CPropertyPage of course.  The code works the same.
Dear expert(s),

A request has been made to close this Q in CS:
https://www.experts-exchange.com/questions/20598694/Delete-a-question.html

Without a response in 72 hrs, a moderator will finalize this question by:

 - Saving this Q as a PAQ and refunding the points to the questionner

When you agree or disagree, please add a comment here.

Thank you.

modulo

Community Support Moderator
Experts Exchange
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

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