Change a button's caption in VC++ MFC?

How can I make a program that once a start button is clicked, the same button's caption
changes to stop. I need to work in VC++ MFC.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

call the buttons SetWindowText member function.
Can you tell me more aobut the button?

I didn't test it, but I would just try making an OnUpdate_ButtonName((CCmdUI* pCmdUI)) function with the Classwizard.
And than a simple
   pCmdUI->SetText (desired_text_string);

and in OnButton() you have somthing like
static bool  started =! started;  //or global with defined init state :)
if (started) strcpy(desired_text_string,"Stop");
else strcpy(desired_text_string,"Start");
with desired_text_string being a global.
Feel free to use CString instead of *char, if you want.

I don't bet it works (I only used it with menus, neverwith buttons), but it's worth a try if noone has a better solution.

keithas approach seems a little bit less complicated ;-).
(As I only say: Only what's easy is good)
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

you can also go to the microsoft msdn to read about button controls

basically, the method suggested by keithas, SetWindowText, should work well.
Use the following function

SetDlgItemText(hDlg, IDC_BUTTON1, "Stop");

hDlg is the Window Handle to the Dialog box, IDC_BUTTON1 is the id for the button control and "Stop" is the new text. You can also use GetDlgItemText to determine what is the current text on the button to see what action to take.

The details are below.

BOOL SetDlgItemText(
HWND hDlg,
int nIDDlgItem,
LPCTSTR lpString);

Microsoft MSDN article

//Get Dialog Item Text
UINT GetDlgItemText(
HWND hDlg,
int nIDDlgItem,
LPTSTR lpString,
int nMaxCount);

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
That's the reason I asked for more info on the button, because noone said, that the button is part of a dialog... ;-)
TMMAuthor Commented:
Ok. Thanks you too! :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

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.