简体   繁体   English

子对话框中从未调用子的DoDataExchange吗? -MFC

[英]Child's DoDataExchange is never called in child dialog ? - MFC

I simply want to open a child dialog and have it print a result from the parent dialog in one of the child's static text controls. 我只是想打开一个子对话框,并在子对话框的静态文本控件之一中从父对话框中打印结果。 Using breakpoints I noticed that both DoDataExchange and my overloaded OnInitDialog are never called in the child so the static text control crashes any time i try to print something to it. 使用断点时,我注意到DoDataExchange和重载的OnInitDialog都不会在子级中调用,因此,当我尝试向其打印任何内容时,静态文本控件都会崩溃。 The child dialog does display itself fine otherwise. 子对话框确实可以正常显示。

What could be the problem ? 可能是什么问题呢 ?

//in parent.cpp
CResultsDlg childResultsDlg = this;
childResultsDlg.DoModal(15.7); //overloaded to pass value to a child member var

more information from my previous post Child Dialog - SetWindowTextA or SendMessageA crashes program - MFC 我以前的文章“ 子对话框”中的更多信息-SetWindowTextA或SendMessageA使程序崩溃-MFC

All of the basics of MFC are covered in the SCRIBBLE tutorial. SCRIBBLE教程介绍了MFC的所有基础知识。

http://msdn.microsoft.com/en-us/library/f35t8fts(v=vs.90).aspx http://msdn.microsoft.com/en-us/library/f35t8fts(v=vs.90).aspx

An example of passing data into a dialog and displaying that data in dialog controls is provided in the tutorial with the CPenWidthsDlg. 本教程的CPenWidthsDlg提供了一个将数据传递到对话框并在对话框控件中显示该数据的示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM