Each control of a dialog window has a unique ID (besides static controls). To access a control, you can pass this ID (see your dialog template in the resource view) to the
GetDlgItem()[
^] function. Once you have a pointer to this control, you can access member functions like
SetWindwText()
which will set the text for edit controls:
CEdit* pEdit = (CEdit*)GetDlgItem(IDC_MYEDIT);
pEdit->SetWindwoText(_T("New text"));
Another option is to assign a member variable to the edit control. You can do this using the resource editor. Then use this variabale to change the text of your edit control (e.g. m_Edit1.SetWindowText(_T("New Text"))). This is the recommended way. If all controls that may be changed have such a member variable and use it for updating, you can omit the calls to
UpdateData()
.