Share via


How to change a Button Caption When it is clicked? VC++(MFC)

Question

Monday, August 17, 2009 5:39 AM

Hi friends,

I need a sample MFC code to change a Button Caption When it is clicked.

ThanksPandi

All replies (1)

Monday, August 17, 2009 5:44 AM âś…Answered

In Windows, you always set the text of a window using the SetWindowText function.

If you have created a control member variable for the button, you can simply call this:

m_btnMyButton.SetWindowText(_T("My new button text"));

else, you will need the handle of the window and call it like this:

::SetWindowText(hWndButton, _T("My new button text"));Geert van Horrik - CatenaLogic
Visit my blog: http://blog.catenalogic.com

Looking for a way to deploy your updates to all your clients? Try Updater!