C++ – how to change caption of button present on MFC dialog box

cmfcvisual c++

I have a MFC dialog box with small text box and button for ok and cancel. Now in some cases I want to change caption of OK and CANCEL button to YES and NO. Is there a way to do this outside of OnInitdialog method of CDialog class

Thanks
Niraj Rathi

Best Answer

You can change those text at any moment (when the dialog window exists) with SetWindowText function, e.g.:

GetDlgItem(IDOK)->SetWindowText("Yes");
Related Topic