Chapter 12: Dialog-Based Windows Visual C++ and MFC Fundamentals
- Click Finish
- 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;
}
- 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
- Scroll down in the Proeprties window and click OnInitDialog. Click its arrow and
clickOnInitDialog