CWnd::Updata的作用
CWnd::UpdateData
调用此成员函数以在对话框中初始化数据,或者取回和验证对话框数据。
BOOL UpdateData(BOOL bSaveAndValidate = TRUE);
参数
bSaveAndValidate
标志(FLASE)表示初始化对话框,(TRUE)表示数据被取回。
返回值
操作成功返回非零,否则返回零。如果bSaveAndValidate 是TRUE, 返回值为非零表示数据获取成功。
Nonzero if the operation is successful; otherwise 0. If bSaveAndValidate is TRUE, then a return value of nonzero means that the data is successfully validated.
评论:
The framework automatically calls UpdateData
with bSaveAndValidate set to FALSE when a modal dialog box is created in the default implementation of CDialog::OnInitDialog. The call occurs before the dialog box is visible. The default implementation of CDialog::OnOK calls this member function with bSaveAndValidate set to TRUE to retrieve the data, and if successful, will close the dialog box. (If the Cancel button is clicked in the dialog box, the dialog box is closed without the data being retrieved.)