Visual C++ Version 4.0
Sample program Viewex
I have been trying to do several examples from books that use Multiple documents derived from CView.
While they show how to swap to differnt views, they never explain the process of creating muliple views so document templates are created automatically. Can you simply create a new class with class wizard and have the document templates automatically created. Is there a way to have the new templates automatically inserted into the application file? The following code is from the Viewex example on the Visual C++ cd. Where can you find the IDR_ names for new views, and where does the third name you insert into the runtime class come from?
// simple text output view
AddDocTemplate(new CMultiDocTemplate(IDR_TEXTTYPE,
RUNTIME_CLASS(CMainDoc),
RUNTIME_CLASS(CMDIChildWnd),
RUNTIME_CLASS(CTextView)));
// simple color output view
// a doc template with no 'fileNewName' so it is not a choice for FileNew
AddDocTemplate(new CMultiDocTemplate(IDR_COLORTYPE,
RUNTIME_CLASS(CMainDoc),
RUNTIME_CLASS(CMDIChildWnd),
RUNTIME_CLASS(CColorView)));
// form view with input
AddDocTemplate(new CMultiDocTemplate(IDR_INPUTTYPE,
RUNTIME_CLASS(CMainDoc),
RUNTIME_CLASS(CMDIChildWnd),
RUNTIME_CLASS(CInputView)));
// splitter frame with both simple text output and form input view
AddDocTemplate(new CMultiDocTemplate(IDR_SPLIT2TYPE,
RUNTIME_CLASS(CMainDoc),
RUNTIME_CLASS(CSplitterFrame),
RUNTIME_CLASS(CTextView)));
// 3-way splitter frame with form input, text output and color output views
AddDocTemplate(new CMultiDocTemplate(IDR_SPLIT3TYPE,
RUNTIME_CLASS(CMainDoc),
RUNTIME_CLASS(C3WaySplitterFrame),
RUNTIME_CLASS(CInputView)));
Thanks !!