注册 登录
编程论坛 VC.NET论坛

MFC中函数作用

jerry820726 发布于 2006-07-19 15:08, 1931 次点击
我刚用MFC 看到好多地方在一段程序后面加了UpdateData(FALSE/true) 这是干什么用的啊?那位告诉下 谢谢?
6 回复
#2
十一月天2006-07-19 15:36
没见过,能把那些代码发上来一些,我看看吗?
#3
NET爱好者2006-07-19 20:50
这个是用来往绑定数据的控件上传值的,具体的msdn你应该看看ddv,ddx相关的详细内容。
UpdateData(true)的意思是把绑定在控件上变量的值传到窗体上显示出来。UpdateData(false)的意思是把控件上的值传到绑定到控件的变量上。
#4
jerry8207262006-07-20 10:55
谢谢楼上的,明白意思了
#5
十一月天2006-07-21 10:22

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

BOOL UpdateData(
BOOL bSaveAndValidate = TRUE
);
Parameters
bSaveAndValidate
Flag that indicates whether dialog box is being initialized (FALSE) or data is being retrieved (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.

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

找到英文的解释了,楼主说的是MFC里的东东啊

#6
jerry8207262006-07-21 12:45

是的,就是这东东,

#7
jerry8207262006-07-21 12:46
谢谢了
1