• Popular Now

• 16
• 15
• 11
• 9
• 10

Archived

This topic is now archived and is closed to further replies.

[MFC MDI] Is there a way to get rid of the document type dialog?

This topic is 5036 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hello, Is there a way to get rid of the doc type dialog when a user press file new, while there is more than 1 type of document temp? ( and have a few type of document created by default? ) Thanks

Share on other sites
Yes, there is. You have to override OnFileOpen in your CWinApp-derived class. You can display your own dialog there or do whatever you want to decide which type you want to open.

Then to finally create a new document use the wanted DocTemplate (the templates you used in CWinApp::InitInstance in AddDocTemplate).

Do the following, probably not all of those are needed:

CDocument*   pDoc;pDoc = pDocTemplate->CreateNewDocument();CFrameWnd* pFrameWnd = pDocTemplate->CreateNewFrame( pDoc, NULL );    pDocTemplate->InitialUpdateFrame( pFrameWnd, pDoc, TRUE );// not that importantpDoc->SetTitle( "New Document" );

Share on other sites
Thanks, Endurion.
With your help, now i got it working.

But then one thing i notice, there has no parameter for size of the child window... ?

Thanks again