DestroyWindow in OnDestroy not working-Collection of common programming errors
Hi I’m making a dialog based application in MFC using:
BOOL CClockMasterDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
m_ModeTabs.Create(this,WS_CHILD | WS_VISIBLE, 0);
}
If I destroy m_ModeTabs
in CClockMasterDlg::OnInitDialog
function after it is created using :
m_ModeTabs.DestroyWindow();
I get no memory but leaks when I place it in CClockMasterDlg::OnDestroy()
I get memory leaks, even tough it gets called and returns true
. I don’t believe that OnDestroy
is OnInitDialog
‘s contrary, but then which function is? There is no OnExitDialog
.
Detected memory leaks! Dumping objects -> {601} client block at 0x00AEED48
, subtype c0, 212 bytes long. a CMFCVisualManager
object at $00AEED48
, 212 bytes long Object dump complete. The program [5312] ClockMaster.exe: Native
has exited with code 2 (0x2).
Even tough the window should be destroyed automatically since it`s not a pointer I still shouldn’t get memory leaks should I? And since placing
m_ModeTabs.DestroyWindow();
in the OnInitDialog
function after its created solves the memory leak it cant really be something else causing the trouble can it? Removing the m_ModeTabs.Create(...
Also solves the memory leak so I’m quite certain that its m_ModeTabs
causing it.