1)How to change a text of a button in runtime?
Answers were Sorted based on User's Feedback
Answer / jp
1. Only required to know the Control Resource ID
((CButton*)GetDlgItem(IDOK))->SetWindowText(_T("Hello"));
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / ps
1. make a control variable of button with the Cbutton class;
2. where you want to change the text then call only setwindowtext();
in header file;
Cbutton mButton;.
IN RESOURCE.H...
#DEFINE BUTTON_ID 249;// CONTROLL ID NUMBER 249 ANY YOU WNT OR SYSTEM GENRATED.
in cpp file.
'''''''mesage map
ABC::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, BUTTON_ID, mButton);
}
BOOL ABC::OnInitDialog()
{
// IF USER CHANGE ON INIT METHOD THEN CAN DO OR CHANGE IN ANY METHOD WITH THE SAME CLASS
mButton.setwindowText(_T"hello");
}
| Is This Answer Correct ? | 0 Yes | 1 No |
what is the difference between SDI and MDI
15 Answers CMC, HCL, Siemens,
How to handle RTTI in MFC ?
What is socket?
What is #progma and where it is used?
If i derive a new class from CObject what are the basic features my derived wil get ?
Explain about MDI and CMultiDocTemplate ?
How you create a button dynamically?
What is the difference between workrer thread and UI thread
How many types of dialog box are their
How to convert a CString variable to char* or LPTSTR?
How can update edit control data of an executing application from other application?
If there is more than 100 control in a window how we can change the Taborder of a controls