passing button control 's input data into a program and manipulate it

I wish to have some buntrol controls, let say button A: 2, Button B:5 and Button C:8. If Button B is chosen, how can i pass the data:5 to a program so that i can take this data into an equation and manipulate it?
Who is Participating?
viktornetConnect With a Mentor Commented:
One way to do it is to send it a message using either PostMessage or Send Message. You might want to defined your own message using WM_USER



Hi kitlee !!
   Its just an extension to VikTor .

#define WM_MYMESSAGE  WM_USER + 1 //For button A
#define WM_MYMESSAGE  WM_USER + 2 //For button B
and so on.......

On click of buttons
PostMessage(hWnd,WM_MYMESSAGE, wParam,lParam);

In a program where u want to trap this message
Hook the message map for ON_MESSAGE(WM_MYMESSAGE, MyFunc);

void MyWndClass::MyFunc(WPARAM wParam,LPARAM lParam)
  //Do whatever u want here
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.