关于CDialog::DoModal

CDialog::DoModal

virtual int DoModal( );  虚函数

Return Value  返回值

An int value that specifies the value of the nResult parameter that was passed to the CDialog::EndDialog member function, which is used to close the dialog box. The return value is –1 if the function could not create the dialog box, or IDABORT if some other error occurred.

一个标识nResult的int值作为参数传递给CDialog::EndDialog成员函数,这个函数用来关闭一个对话框。如果函数不能创建一个对话框,则返回-1,否则,如果其他错误发生的话,将返回IDABORT值

Remarks   注释

Call this member function to invoke the modal dialog box and return the dialog-box result when done. This member function handles all interaction with the user while the dialog box is active. This is what makes the dialog box modal; that is, the user cannot interact with other windows until the dialog box is closed.

调用这个函数去产生一个模态对话框,且当完成后会返回对话框的结果。当此对话框在激活状态时,这个成员函数会处理用户与对话框的交互。除非这个对话框被关闭了,要不然用户没法与其他对话框完成交互。

If the user clicks one of the pushbuttons in the dialog box, such as OK or Cancel, a message-handler member function, such as OnOK or OnCancel, is called to attempt to close the dialog box. The default OnOK member function will validate and update the dialog-box data and close the dialog box with result IDOK, and the default OnCancel member function will close the dialog box with result IDCANCEL without validating or updating the dialog-box data. You can override these message-handler functions to alter their behavior.

如果用户点击了对话框上的按钮,如Ok或Cancel,将会调用对应的消息句柄成员函数,如OnOk或OnCancel,将会被调用,然后关闭这个对话框。默认的OnOk成员函数将会更新对话框的数据然后返回结果IDOK,接着关闭对话框。而默认的OnCancel成员函数将会返回结果IDCANCEL后关闭对话框,并不使得有效或是更新对话框数据,你可以重载这两个函数去改变他们的行为。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值