Posted on 2007-03-26
I have some icons that I place in a new CImageList in the OnCreate in CMainFrame. I the set several set them as icons to several of my buttons. In the destructor for CMainFrame, I DeleteImageList() and then delete the CImageList. When I close the program, Boundschecker tell me that I have resource leaks and tells me that I have to delete the icons that I set to the buttons so in OnClose for CMainFrame I tried to delete the icons like this for each button:
btn = (CButton*)m_wndMyCTRLBar.GetDlgItem( IDC_BUTTON1);
Boundschecker still says that I have the resource leaks. Am I suppose to delete them from another event or am I deleting them incorrectly. Please help end my confusion.