Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Subclassing a dialog class

Posted on 2001-06-20
2
Medium Priority
?
287 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 400 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

926 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