Solved

Subclassing a dialog class

Posted on 2001-06-20
2
264 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
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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.

776 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