I'm trying to add images to imagelist of toolbar, which is a member of CMainFrame
startStopPicture.LoadBitmapW(IDB_STOP_PIC);
m_ToolBar.GetToolBarCtrl().GetImageList()->Add(&startStopPicture, reinterpret_cast<CBitmap*>(NULL));
startStopPicture.DeleteObject();
startStopPicture.LoadBitmapW(IDB_START_PIC);
m_ToolBar.GetToolBarCtrl().GetImageList()->Add(&startStopPicture, reinterpret_cast<CBitmap*>(NULL));
then I need to access this imagelist from childview. I'm trying do to it like this
CMainFrame* mainFrame = dynamic_cast<CMainFrame*>(GetParentFrame());
CImageList* imList = mainFrame->m_ToolBar.GetToolBarCtrl().GetImageList();
But those images I added in the mainframe's method are absent now. How to solve this promlem?