MFC中UpdateData()使用

本文详细介绍了 C++ MFC 框架中的 UpdateData 函数,该函数用于初始化对话框数据及验证对话框数据。当创建模式对话框时,框架会自动调用此函数,并在对话框可见之前设置参数 bSaveAndValidate 为 FALSE;当点击确定按钮时,则将此参数设置为 TRUE 来获取数据并验证数据的有效性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

UpdateDate()只有一个参数,默认参数为TRUE。其作用如下:
用于初始化对话框数据和接受合法的对话框数据。(Call this member function to initialize data in a dialog box, or to retrieve and validate dialog data.)

BOOL UpdateData(
   BOOL bSaveAndValidate = TRUE 
);

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值