CDialogEx undefined class

Posted on 2012-09-15
Last Modified: 2012-09-20
I  am  creating MDI project with CFormView.
On Views Form dialog I  placed a  button.
And  inserted one more dialog  in project  (IDD_DIALOG1)
Created One class(CDia) derived from CDialogEx which is using (IDD_DIALOG1) using "AddClass"
On Button click  I  written  following code
CDia  dia;

And added appropriate header file "Dia.h"
On compiling  it gives error CDialogEx  undefined.
I  am using Visual Studio 2010 Professional
Please help me to solve thia issue
Question by:enthurao
    LVL 86

    Expert Comment

    Can you post the relevant code?

    Author Comment

    class CDia : public CDialogEx
    	CDia(CWnd* pParent = NULL);   // standard constructor
    	virtual ~CDia();
    // Dialog Data
    	enum { IDD = IDD_DIALOG1 };
    	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
    void CMerilisaRView::OnBnClickedButton1()
    	CDia cd;

    Open in new window

    Error    1    error C2504: 'CDialogEx' : base class undefined  e:\aditya
    practice\merilisar\merilisar\dia.h    7    1  MerilisaRHandlers
    Error    2    error C2039: 'DoModal' : is not a member of 'CDia'
     e:\aditya practice\merilisar\merilisar\merilisarview.cpp    118  1  
    LVL 32

    Accepted Solution

    CDialogEx is defined in afxdialogex.h. if you create a new mfc application project the afxdialogex.h was available, probably via afxcontrolbars.h.

    i suppose your project was created in a previous version of visual studio.

    if you want to use the newest features of vs2010 you could try to include that header manually in the stdafx.h. if that doesn't work (or needs more includes), i would recommend you create a new vs2010 project by wizard, delete all newly generated source files beside of stdafx.h from solution tree (project tree), copy all source files other than stdafx.h from old project, add those files to project tree again and rebuild.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Some Windows API functions expect you to provide a pointer to a CALLBACK function that the system will need to call as part of the operation.  Such API functions as SetTimer, timeSetEvent, CreateThread, EnumWindows, LineDDA, even window message hand…
      Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
    The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
    The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now