Solved

Subclassing a dialog class

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

821 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