如何在VC ++ MFC中的两个对话框之间传输编辑框数据 [英] How to transfer edit box data between two dialogs in vc++ mfc

查看:448
本文介绍了如何在VC ++ MFC中的两个对话框之间传输编辑框数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个对话框,分别是Dialog1和Dialog2.
在Dialog1中,我在Edit Box中输入了一些值,因此我需要在Dialog2 Edit Box中输入更新后的值.
请帮助我.

I have two dialogs which is Dialog1 and Dialog2.
In Dialog1, I entered some value in Edit Box, so I need that entered updated value in Dialog2 Edit Box.
Please help me.

推荐答案

您可以尝试将消息从Dialog1发布到Dialog2,并让Dialog2通过更改其编辑框来响应.如果您以一种方式保持通信并使用 PostMessage [ ^ ]它应该可以工作.

Code Project在消息管理 [
You might try posting a message from Dialog1 to Dialog2 and have Dialog2 respond by changing its edit box. If you keep the communication one way and use PostMessage[^] it should work.

Code Project has a nice article on message management[^].


您可以访问对话框的其他变量通过执行以下操作来创建:

CMyDialog dlg;

if(dlg.DoModal()== IDOK)
{
myVariable = dlg.otherDialogVariable;
做点什么...
}

希望这会有所帮助!
DrB
You can access other variables of dialog boxes you have crreated by doing the following:

CMyDialog dlg;

if(dlg.DoModal() == IDOK)
{
myVariable = dlg.otherDialogVariable;
Do something...
}

Hope this helps!
DrB


这篇关于如何在VC ++ MFC中的两个对话框之间传输编辑框数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆