Let's talk in a dialog box, we dynamically create a variable number of CWnds ... for example, create a and register CButton every time the user does something /
Some pseudo codes ...
class CMyDlg : public CDialog
{
vector<CWnd *> windows;
void onClick()
{
CButton *pButton = new CButton(...);
windows.push_back(pButton);
}
}
Do I need to explicitly delete them or will there be an MFC? If I need it, it would be in the destructor as usual, or are there some special things not to violate the MFC ... making sure that I do not delete objects while the HWND is still in use, for example?
source
share