Originally posted by: Markus Krosche
If your MFC code overloads the
OnOpenDocument(LPCTSTR lpszPathName) member and you return FALSE the application crashes.
The solution:
Change the member CMvDocTemplate::CleanDocument to do
the following:
// Must delete the associated frame manager.
CDocFrameMgr* pDocFrameMgr = GetAssociatedDocFrameMgr(_pDoc );
// Now you must check whether the pointer pDocFrameMgr
// is 0 otherwise the application crashes!
if (pDocFrameMgr) // <--- change this!!!
{
m_DocumentFrameList.RemoveAt
( m_DocumentFrameList.Find ( pDocFrameMgr ) );
delete pDocFrameMgr;
}
Now the code works ...
Originally posted by: Venkatesh N.K.
I downloaded your program, but vc++ not allowing to compiling your application why? Please send email for the above reason. And suggest referance for Multiple Views for
single document.
With Regards,
N.K.Venkatesh,
C-CADD,
National Aerospace Lab.,
Bangalore - 37.
krishna_venky@rediffmail.com
phone : 5274649 Extn. 4410.
Originally posted by: KlangenFarben
unsure "ctrl+break" is "obscure", but ctrl+L is awesome stuff.
as is most others.
can't wait to blow the client's mind next show&tell
Originally posted by: Paul Wardle
My intention is to have a text file containing a script (editable, based on CEditView). The document
contains all information about the script, and the document also contains the script's runtime information
when the script is running. Therefore when the script is executed, it is possible to spawn different views
each containing different information about the state of the running script.
The doc template class seems OK for normal documents, but falls over when I want to call OpenDocument and
create a document based upon CEditView (ie. the document's text is all contained within the CEditView's CEdit
control on the frame window).
The CMvDocTemplate::OpenDocumentFile calls CDocument::OnOpenDocument.
*BUT* documents with views based upon CEditView rely on the view being created BEFORE the document. So I
cannot call CEditView::Serialize to load the documents in CScriptDoc::Serialize(). CMultiDocTemplate creates
the frame window BEFORE calling OnOpenDocument.
In the project "MvTest", This can be shown by deriving CView1 from CEditView, then changing
CMvTestDoc::Serialize() to contain this code (this is similar to the code that AppWizard produces) :
void CMvTestDoc::Serialize(CArchive& ar)
How can I change the code to work as I need it (is it simply to create a frame window before the call to
OnOpenDocument???)
Thanks for the help in advance, anyone!
Thanks for this code; it does exactly what I want (or rather it would if it worked :)
CDocument::OnOpenDocument calls CScriptDoc::Serialize() to load the document.
{ ((CEditView*)m_viewList.GetHead())->SerializeRaw(ar); }