MFC 处理来自单独窗口的消息
我已经创建了一个带有一些控件的窗口,并且当前正在使用它。在某些消息中,我打开一个单独的类
inPUT* ppFrame = new inPUT(hmm::n,hmm::yDim);
ppFrame->ShowWindow(SW_SHOW);
并在其中输入一些数据,将其保存在该类中的某个位置并关闭它。 问题:例如,当我知道数据已被 ppFrame 接收时,如何将该数据返回到 ppFrame 的原始类 ON_WM_CLOSE() 而不是原始类
I have created a window with some controls and currently work with it. On some message I open a separate class as
inPUT* ppFrame = new inPUT(hmm::n,hmm::yDim);
ppFrame->ShowWindow(SW_SHOW);
and input some data there, save it somewhere in that class and close it.
Question: how can I get that data back to the original class ON_WM_CLOSE()of ppFrame not an original class for example, when I know that the data was already received by ppFrame
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将需要传递一个指向原始类的指针。然后在处理WM_CLOSE消息时设置数据。假设原始类正在处理创建另一个窗口的消息(并且原始类的寿命比输入窗口长):
在 WM_CLOSE 上,您可以使用 this 指针执行以下操作:
You are going to need to pass in a pointer to the original class. Then set the data when handling the WM_CLOSE message. Assuming the original class is handling the message that creates this other window (and the original class lives longer than the inPUT window):
on WM_CLOSE you can do the following using that this pointer: