Opening a new document
-
How do I open a new document in a MDI app without using CView::OnFileNew(). The app supports multiple doc's and I want to be able to open new one's from anywhere. I am sure it is simple. Thank you in advance.
-
How do I open a new document in a MDI app without using CView::OnFileNew(). The app supports multiple doc's and I want to be able to open new one's from anywhere. I am sure it is simple. Thank you in advance.
-
How do I open a new document in a MDI app without using CView::OnFileNew(). The app supports multiple doc's and I want to be able to open new one's from anywhere. I am sure it is simple. Thank you in advance.
You need a pointer to the document template you want to open a document for. In MFC these templates are stored in a CDocManager class object pointer which is part of your CWinApp object. You could do this: CDocManager *pDocMan = AfxGetApp()->m_pDocManager; POSITION pos ; pos = pDocMan->GetFirstDocPosition(); while (pos) { CDocTemplate *pTemplate = pDocMan->GetNextTemplate(pos); pTemplate->OpenDocumentFile(filename); // or NULL ofr an empty document } I may have some of the function names wrong here as its from memory. Roger Allen Sonork 100.10016 In case you're worried about what's going to become of the younger generation, it's going to grow up and start worrying about the younger generation. - Roger Allen, but not me!
-
How do I open a new document in a MDI app without using CView::OnFileNew(). The app supports multiple doc's and I want to be able to open new one's from anywhere. I am sure it is simple. Thank you in advance.
Roger has one way of doing it... We use CWinApp::OpenDocumentFile(LPCTSTR lpszFileName). Does the same thing, but automatically. :) J
May the bear never have cause to eat you.