What is the proper way to implement this?
-
In my MDI project. MainFrame has a m_CoolBarCtrl, m_TabCtrl and m_DirTreeCtrl. they are all dynamically created. in the Create funcation specify parent CWnd. m_CoolBarCtrl parent is MainFrame m_TabCtrl parent is m_CoolBarCtrl m_DirTreeCtrl parent is m_TabCtrl When user click on a abc.cpp file in the DirTree, I want to notify the main frame to open this file. How can I implement this? Please give me a direction.
-
In my MDI project. MainFrame has a m_CoolBarCtrl, m_TabCtrl and m_DirTreeCtrl. they are all dynamically created. in the Create funcation specify parent CWnd. m_CoolBarCtrl parent is MainFrame m_TabCtrl parent is m_CoolBarCtrl m_DirTreeCtrl parent is m_TabCtrl When user click on a abc.cpp file in the DirTree, I want to notify the main frame to open this file. How can I implement this? Please give me a direction.
Use AfxGetMainWnd() and dynamic_cast to obtain a valid pointer to CMainFrame. Then Call the method to open the file. Thats it!!! Alternatively you can send a message to the Mainframe HWND and handle it accrodingly in your CMainFrame class. But I suggest using the first approach. "A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors." XMinds