Communication with Splitters
-
EDIT: I Solved my own problem I moved my button-logic to the MainFrm.cpp class, and used the GetPane() function to access the correct pane. I guess the best solutions are the ones you come up with yourself. ******************************************************************************************** Original Post Below: I've read a number of posts here about communicating when using splitters, but I'm still having a problem, so I'd appreciate any help. I have an SDI application with a toolbar and three views ... one of which is a CHtmlView derived view. I'm trying to control the web browser control using the toolbar buttons. Here's what I have: ------------------- I have a pointer to the MainFrm object in my MyApp.cpp (defined MyApp.h). In my MainFrm.cpp, I'm using the RUNTIME_CLASS(CClassType) macro to create each of the three splitter panes, and I'm saving pointers to each views. In MyApp.cpp, I have a message handler for the user clicking the "Back" button:
void CMyApp::OnBack(){ CMainFrame* p_localMainFrameRef = (CMainFrame*) p_viewMain; CMyAppHTMLView* p_localWebFrameRef = (CMyAppHTMLView*)(p_localMainFrameRef->p_viewWeb); p_localWebFrameRef->GoHome(); }
I'm getting the following error when I click the "Back" button:Unhandled exception at 0x7c1a8130 (mfc71d.dll) in YourApplication.exe: 0xC0000005: Access violation reading location 0x00003972.
Can anyone lend some advice as to what I'm doing wrong ... or suggest a better approach to allowing me to communicate between frames, and with the toolbar? Thanks very much, telstar