Suppose you want to create a new document manually in your MDI application. The following code allows to do this. It assumes that theApp is a CWinApp derived class holding a pointer m_pMyDocTpl to the CMultiDocTemplate which will instantiate your document. But you can use the CWinApp::GetFirstDocTemplatePosition() and CWinApp::GetNextDocTemplate() functions to select the type of document template.
CMultiDocTemplate* pDocTpl = theApp.m_pDocTpl;
CDocument* pDoc = pMyDocTpl->CreateNewDocument();
CFrameWnd* pFrame = pDocTpl->CreateNewFrame( pDoc, NULL);
pDocTpl->InitialUpdateFrame( pFrame, pDoc);