原创 MFC对话框-UpdateData()函数使用

2016-4-8 10:04 1030 13 13 分类: 软件与OS

1)CWnd::UpdateData

BOOL UpdateData( BOOL bSaveAndValidate = TRUE );

Return Value

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.

Parameters

bSaveAndValidate

Flag that indicates whether dialog box is being initialized (FALSE) or data is being retrieved (TRUE).

Remarks

Call this member function to initialize data in a dialog box, or to retrieve and validate dialog data.

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.)

2)

UpdateData() and Updatedata(TRUE) are the same.

UpdateData(TRUE) is used to copy the contents of the controls into the associated variables.
UpdateData(FALSE) is used to put the values in the variables to the associated controls.

文章评论0条评论)

登录后参与讨论
我要评论
0
13
关闭 站长推荐上一条 /2 下一条