简体   繁体   English

如何在mfc项目中创建新窗口

[英]how to create new window in mfc project

hi im using c++ mfc. 您好,即时通讯使用C ++ MFC。 i have main window which works all the time and i want to make new window. 我有一直工作的主窗口,我想创建新窗口。 how can i do it? 我该怎么做? thanks 谢谢

Hi you can create your own dialog by VS master and then do // on some event 嗨,您可以通过VS master创建自己的对话框,然后在某些事件上//

CMyDialog dlg;
dlg.DoMoDal();

link http://www.codersource.net/mfc/mfc-tutorials/dialog-boxes-in-mfc.aspx 链接http://www.codersource.net/mfc/mfc-tutorials/dialog-boxes-in-mfc.aspx

  1. Create a dialog resource in the resource editor. 在资源编辑器中创建一个对话框资源。

  2. Right click it and choose "Add Class". 右键单击它,然后选择“添加类”。

  3. Make sure the parent class is "CDialog" or any other you'd like and hit ok. 确保父类是“ CDialog”或您想要的其他任何类,然后单击“确定”。

  4. Visual Studio class wizard will now create the necessary files you can now override window messages...etc Visual Studio类向导现在将创建必要的文件,您现在可以覆盖窗口消息...等

Easiest way to show your new dialog by calling: 通过调用以下命令来显示新对话框的最简单方法:

CMyNewDialog dlg;
dlg.DoModal();

and make sure you include the newly created dialog class header file, should be: MyNewDialog.h 并确保您包括新创建的对话框类头文件,应为:MyNewDialog.h

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

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