本文介绍了创建一个从CDialog派生的类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,
我正在创建一个从CDialog派生的类,假设该类名称为"CBase".
我希望它充当MFC的CDialog,并且从基类派生的任何类都将创建一个对话框.我该怎么办?
我尝试过休假

dear,
I''m creating a class derived from CDialog, suppose that class name it is ''CBase''.
I want it acting as CDialog of MFC and any class derived from base create one dialog box. What can I do for it?
I tried out as fallows

CBase : public Cdialog
{
    CBase(CWnd* pParent = NULL);   // standard constructor

    //{{AFX_DATA(CTestDlgBase)
    enum { IDD = _UNKNOWN_RESOURCE_ID_ };

    protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV protected:

    DECLARE_MESSAGE_MAP()

}
Cderive : public CBase
{
Cderive(CWnd* pParent = NULL);   
   //{{AFX_DATA(CTestDlgBase)
   enum { IDD = _UNKNOWN_RESOURCE_ID_ };

   protected:
   virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV protected:

   DECLARE_MESSAGE_MAP()

}



但由于休假而出现错误
错误C2065:"_ UNKNOWN_RESOURCE_ID_":未声明的标识符
错误C2057:期望的常量表达式

当我创建类CBase&的对象时调用DoModal时,对话框未显示.
我该怎么办?



but I got error as fallows
error C2065: ''_UNKNOWN_RESOURCE_ID_'' : undeclared identifier
error C2057: expected constant expression

also when I create object of class CBase & calling DoModal the dialog isn''t shown.
What can I do for it?

推荐答案




这篇关于创建一个从CDialog派生的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 23:50