Jump to content
  • Advertisement

Archived

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

NewbieA

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

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 important

pDoc->SetTitle( "New Document" );

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!