Solved

Subclassing a dialog class

Posted on 2001-06-20
2
271 Views
Last Modified: 2013-11-20
Can you subclass a dialog?  I am thinking something along the lines of just adding a constructor to my dialog class that allows the IDD to be passed in, so you can basically run the same dialog with additional functionality and a different GUI on it.

Or it could have the additional functionality inside the original dialog, and just do the construction with the different IDD.  No subclass, just allowing a different GUI.

Any reasons why not to do something like this?
0
Comment
Question by:appleby
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 30

Accepted Solution

by:
Axter earned 100 total points
ID: 6212601
There should be no problem with doing this.

The only thing you have to look out for is to make sure you use the proper constructor, and that your child class sets up that constructor correctly.

Example:
//header *.h file
class xxCDialog : public CDialog
{
public:
     xxCDialog(UINT nIDTemplate, CWnd* pParent = NULL):CDialog(nIDTemplate,pParent){};
};

//*.cpp file
xCDialog::xCDialog(UINT nIDTemplate, CWnd* pParent)
: xxCDialog(nIDTemplate, pParent)
{
}
0
 

Author Comment

by:appleby
ID: 6214319
Great, that's just what I'd intended.  Thanks!!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

628 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