mfc子窗口创建问题

jerry1911415 2012-06-22 07:01:37
我创建了一个窗口,然后在该窗口创建一个按钮,点击该按钮会弹出一个对话框,这个对话框关联了自己创建的一个类CDlgEnlarge,该类的基类为CDialog,在按钮响应函数里面的代码是
void CRemoteDlg::OnBtnenlarge()
{
// TODO: Add your control notification handler code here
CDlgEnlarge enlargeDlg;
enlargeDlg.DoModa();
}
调试时发现执行CDlgEnlarge enlargeDlg;后,得到CDlgEnlarge hwnd=0x00000000;
不知道哪儿的错,求各位大神帮忙解决一下
...全文
331 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
hanyingmenghuan 2012-06-23
  • 打赏
  • 举报
回复
ms没有DoModa()。
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.

sunxc123 2012-06-22
  • 打赏
  • 举报
回复
enlargeDlg.DoModa()…………>enlargeDlg.DoModal()

coolcoffee4051982 2012-06-22
  • 打赏
  • 举报
回复
CDlgEnlarge *dlg=new CDlgEnlarge;
dlg->Create(IDD_DIALOG1,this);
dlg->ShowWindow(SW_SHOW);
用非态对话框看dlg就明显了,模态的就是hwnd=0x00000000;
hyqok 2012-06-22
  • 打赏
  • 举报
回复
把CDlgEnlarge 贴出来看一下.
schlafenhamster 2012-06-22
  • 打赏
  • 举报
回复
调试时发现执行CDlgEnlarge enlargeDlg;后窗口还没产生!

当然 :得到CDlgEnlarge hwnd=0x00000000;

到对话框的Init中去调试。

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧