Hi I've downloaded a non-MFC project and added MFC support to it.

It has compiled fine and I was able to use CString, AfxMessageBox.

The next step I took was adding a CDialog class to this project.

I used the Class Wizard and tried to create a CDialog-based dialog class,

but the Wizard told me I can't create this class in non-MFC project.

I guess this is because I've just added MFC support, not actually creating one.

So I managed to write down a CDialog class myself, and I copy & pasted CDialog

code from another MFC project. It gave me whole bunch of errors.

The errors were about dialog resource id, OnInitDialog, m_hIcon, SetIcon, each

informing me it wasn't declared, called a non-static member function, cannot find

the identifier. (I use non-english version of visual studio 2005, so the message might

be a bit different)

I know it's quite tedious to write down what I have to do to handle these errors,

I'd be happy enough for the links that I can reference. Of course, I'd really appreciate

it if anyone gives me the error-handling details. Thanks!

Re: Visual C++ General How to make CDialog-based dialog in non-MFC project?


The best thing is to generate a new MFC application using the New project wizard. Then look at the stdafx.h file that was generated. This will be a clue as to what files you need to include in your other project.

Re: Visual C++ General How to make CDialog-based dialog in non-MFC project?

Prasad Somwanshi

Basic header you need to include for MFC classes is afxwin.h . Your errors should be solved by including this.

And make sure, user32.lib is linked.