Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Button Function

Status
Not open for further replies.

MarkPQ

Programmer
Feb 21, 2002
7
AU
Hi All,

I'm currently making my first dialog application in VC++ and I am learning several things all at once and its becoming a bit overwhelming. I'm making an application that connects to a serial device and gets data from it. What I want to do is have a button that normally displays 'Connect' on its caption. When the user clicks it will obviously connect to the device, but what I want to do is change the caption on the button to say 'Disconnect', so that when the user clicks again it will do just that!

Any help on what functions I should look at would be appreciated!

Thanks,
Mark
 
In your MyButtonClicked() routine, you change the text using:

MyButton.SetWindowText("Disconnect");

A member variable can store the state of the button and toggle it each time it is clicked.

Hope that helps! :cool:
 
Thanks . . . That's perfect!

hehehe, I knew it'd be something simple, but I guess the only way you get to learn about all the functions you have available is by using them over time, and I guess you have to start somewhere!

Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top