Hello guys,
In MFC, I understand using updateData() function, which in turn calls DoDataExchange, controls variables of a dialog can be set or get.
We can also set or get values of control variables using SetDlgItemText() and GetDLGItemText() method.
What is the difference between above two??
I think in using SetDlgItemText() and GetDLGItemText() method, we can set ot get value at runtime. we do not need member string variable.
Below is the small example.
suppose I have a check box control.
a) using DDX, I would write code like this to get or set data.Based on the argument of update data, it would decide whether value had to be set ot get.
void CMyDlg::DoDataExchange(CDataExchange* pDX)
{
DDX_Text(pDX, IDC_MINEVENTLENGTH, m_iMinEventLength);
}
b)I can also set or get value of control like below.
GetDlgItemText(hWnd, IDC_MINEVENTLENGTH, MinEventLength, _countof(MinEventLength));
SetDlgItemText(hWndDlg, IDC_MINEVENTLENGTH, MinEventLength);
Please help.
Regards,
Joy