Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to inherit a MFC dialog box?

peace_lppeace_lp Member Posts: 2
Hi all,

I have created a dialog box (cMyDialog). I am planning to duplicate cMyDialog and called it cMyDialog2. Can I know in MFC, how can I do inheritance? I want the cMyDialog2 to inherit all the IDDs from cMyDialog1 so that I do not have to copy and paste the codes from cMyDialog1 and cMyDialog2. The purpose of cMyDialog2 is to inherit all the functions from cMyDialog1 so that I do not have to redefine the functions in cMyDialog2 again and to add some extra functions in it.

thank you very much in advance for your help and advices

Comments

  • stoberstober Member Posts: 9,765 ✭✭✭
    Its done exactly like any other c++ class. If you need message maps in your new dialog then add the DECLARE_MESSAGE_MAP macro in the header file (see the original dialog's header file for example).
    =============================================
    never lie -- the government doesn't like the competition. (Author unknown)
  • peace_lppeace_lp Member Posts: 2
    Hi,

    I tried to use DECLARE_DYNAMIC macro but receive errors of base class not being found. Can you please help to advice? I tried using the C++ inheritance but also receive the same errors.

    Thanks a lot for your help.
Sign In or Register to comment.