Link to home
Start Free TrialLog in
Avatar of meetze
meetze

asked on

Is this possible?

I have a dialog box (CDialog1) that has a few buttons and a list control.  Now I have another Dialog Box (CDialog2) that has the same items plus one more list control on it.  Is it possible to derive Dialog2 from Dialog2??  Do I have to name the controls the same?  The two dialog boxes do the same thing except CDialog2 has one more control, I am trying to avoid writting the same code for both dialog boxes.  Thanks.
Avatar of TKII
TKII

Have a look at control subclassing in the online-help. Perhaps you can drive the class for the second dialog from the class for dialog1 or create a base class for both dialogs.
The solutoion for meetze has nothing to do with control subclassing. meetze's needs can be addressed with C++ subclassing.

..B ekiM
ASKER CERTIFIED SOLUTION
Avatar of RONSLOW
RONSLOW

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

The solution to your problem seem to be:

class CDialog1 : public CDialog
{
   public:
       CDialog1();
   private:
       CControl1   *m_pCont1;
};

class CDialog2 : public CDialog1
{
   public:
      CDialog2();
   private:
      CControl   *m_pCont2;
};


Here the second object is derived from the first.