Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Chapter 12: Dialog-Based Windows Visual C++ and MFC Fundamentals



  1. Click Finish

  2. In the constructor of the dialog, use the new operator to allocate memory for the
    dynamic control. Then, in the destructor, destroy the control using the delete
    operator:


CDynamicDlg::CDynamicDlg(CWnd* pParent /*=NULL*/)
: CDialog(CDynamicDlg::IDD, pParent)
, m_Panel(NULL)
{
m_Panel = new CWnd;
}

CDynamicDlg::~CDynamicDlg()
{
delete m_Panel;
}


  1. To fire the OnInitDialog event for the dialog, in the combo box of the Properties
    window, CDynamicDlg should be displaying. If not, in Class View, click
    CDynamicDlg


In the Properties window, click the Overrides button


  1. Scroll down in the Proeprties window and click OnInitDialog. Click its arrow and
    click OnInitDialog

Free download pdf