How can i display a dialog window with adding a class to it and using the following to invoke it:

CClasX dlg(this);
dlg.DoModal();

I know you can do it without a class but im not sure how.
And second why would you want to invoke a dialog without a class - are they advantages?

Thanks

> How can i display a dialog window with adding a class to it
Just derive your CClasX from a CDialogBox and add what you want in the OnInitDialog function.
Without deriving from MFC, there is an api call I think, you can check the MFC source.
>why would you want to invoke a dialog without a class
If you have nothing to add to that dialog by inheriting from the base class, there is no advantage in using the MFC class. Without a clas you will save a little overhead, but this is just noise in the big scheme..

This is a good tutorial about how to write non-MFC programs. It shows you how to create dialog boxes from scratch. You could integrate some of it into an MFC program if you want. And here is a good non-MFC XMessageBox that can be easily added to an MFC program (I have already done that), and it works very well.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.