I have a valid CRichEditView pointer that I retrieved by doing this from within my CMainFrame class:
CWinApp::GetNextDocTemplate(...);// to get the CDocTemplate
CDocTemplate::GetNextDoc(...);// to get the CRichEditDoc
pRichView = CRichEditDoc::GetView();// to get the CRichEditView
I have two huge problems:
1) it doesn't make the view active (actually, nothing happens)
2) when I exit the app, i get the standard winXP "Application has encountered a problem and needs to close. We are sorry for the inconvenience." send error report dialog...
What am I doing wrong??? The view that I retrieve from GetView() is valid... Should I do more than just the line SetActiveView() ?
I figured out a way around it and just wanted to update in case anyone else ever runs into this...
What I was trying to accomplish was this: In an MDI app I have a docking bar with a list of output from a compiler. If there are errors or warnings, you can double click on them and the file with the error will open and the line with the error will be selected (similar to how VC++ works). My problem was that if there were more than a single file open and the file double-clicked on was under another one in the window, I couldn't get it to pop up on top of the others.
I accidentally figured out how to accomplish this. Before, I would open the file if it wasn't already open, otherwise I was trying to pop it on top with SetActiveView(). Now, I am just calling OpenDocumentFile() regardless of whether or not it is already open. If it is not open, it opens it; if it is already open, it is pushed to the top of the zorder.
Hope this helps someone else...