• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 214
  • Last Modified:

Setting pushbutton caption

I'm pretty new to MFC, and I have the following problem:

I simply want to change the the caption of a pushbutton so that when the user clicks it, the text changes from "Start" to "Stop"or vice versa. I don't want to use bitmaps, and I don't want to create two buttons and show/hide them - I would like to learn how to programatically change the text of just one button.

In an MFC created dialog-based app called MyTest, with classes MyTest and MyTestDlg, and a pushbutton called  ID_START_STOP, how do I implement this feature ?

Thanks a lot,


  • 2
1 Solution
The following lines must be placed in your CDialog object
(perhaps in the OnStartStop handler function):

CString newCaption;
// set newCaption to the desired text

I would suggest that you re-open this question with 50 points - 100 points are really much for
this question :) :) :)

boedekerAuthor Commented:
Thanks for the answer snoegler - it works fine, so post anything as an answer and I'll give you the points :)

Thanks :)
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.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now