3

i am not so familiarize with the VC++ programming. i have heard that, while reading/writing to window text box, we have to use the update data function.(UpdateData(true), UpdateData(false)). Other wisw we can't perform the read/write operation on the text box.

Why we are using this function? What this function does?

4

1 回答 1

1

该机制称为动态数据交换。当您调用 UpdateData 方法时,它会设置类 CDataExchange 的成员并调用 DoDataExchange。DDX 只不过是内部调用 SetDlgItemText 或 GetDlgItemText 的全局函数。

设置/获取窗口文本的另一种方法是直接调用这些函数,例如

CEdit* pBoxOne;
pBoxOne = (CEdit*) GetDlgItem(IDC_EDIT1);
pBoxOne->SetDlgItemText("asd");
于 2012-05-17T10:19:15.397 回答