The toolbar and status bar objects you'll be working with are attached to the application's main frame window, not to the view window. How does your view find its main frame window? In an SDI application, you can use the CWnd::GetParentFrame function. Unfortunately, this function won't work in an MDI application because the view's parent frame is the MDI child frame, not the MDI frame window.
If you want your view class to work in both SDI and MDI applications, you must find the main frame window through the application object. The AfxGetApp global function returns a pointer to the application object. You can use that pointer to get the CWinApp data member m_pMainWnd. In an MDI application, AppWizard generates code that sets m_pMainWnd, but in an SDI application, the framework sets m_pMainWnd during the view creation process. Once m_pMainWnd is set, you can use it in a view class to get the frame's toolbar with statements such as this:
CMainFrame* pFrame = (CMainFrame*) AfxGetApp()->m_pMainWnd; CToolBar* pToolBar = &pFrame->m_wndToolBar;
You'll need to cast m_pMainWnd from CFrameWnd* to CMainFrame* because m_wndToolBar is a member of that derived class. You'll also have to make m_wndToolBar public or make your class a friend of CMainFrame.
You can use similar logic to locate menu objects, status bar objects, and dialog objects.
In an SDI application, the value of m_pMainWnd is not set when the view's OnCreate message handler is called. If you need to access the main frame window in your OnCreate function, you must use the GetParentFrame function.