CFrameWnd中的MFC CDailog [英] MFC CDailog in CFrameWnd

查看:258
本文介绍了CFrameWnd中的MFC CDailog的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在MainWnd类中创建当前的CDailog:public CFrameWnd?
您不能提供代码示例.

谢谢.

How can I create current CDailog in class MainWnd: public CFrameWnd ?
Can''t you give an code exaple.

Thanks.

推荐答案

我不太确定您在这里说的是什么,但是如果您只想显示模式(即用户只能与以您的主框架为父框架的对话框进行交互,这真的很容易.
我想做的是像这样从CDialog派生一个类:
I''m not pretty sure what you''re talking about here, but if you just want to display a modal (that is, the user can only interact with the dialog) dialog that has your main frame as a parent, it''s really easy.
What I like to do, is to derive a class from CDialog like this:
class CMyDialog : public CDialog
{
   /* CDialog declarations here */
};


然后,我将其映射到对话框资源.创建此类的最佳方法是使用MFC类向导.首先创建对话框资源,然后使用向导创建MFC类.将基本类设置为CDialog,将ID设置为对话框的ID(例如IDD_MYDIALOG).然后实例化该类并调用DoModal()函数.


Then I map it to a dialog resource. The best way to create this class is by using the MFC class wizard. First create the dialog resource and then create the MFC class using the wizard. Set the Base Class to CDialog and the ID to your dialog''s ID (e.g. IDD_MYDIALOG). Then instantiate the class and call the DoModal() function.

CMyDialog* pDialog = new CMyDialog();
pDialog->DoModal();


就是这样.


That''s all.


这篇关于CFrameWnd中的MFC CDailog的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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