Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Oncreate problem

Posted on 1998-05-21
3
Medium Priority
?
321 Views
Last Modified: 2013-11-20
In the oncreate handler of my CMDIChild derived class I display a property sheet allowing the user to select options before the window is displayed. If the user selects cancel I exit the handler returning a -1. This prevents the window from being displayed but gives me the prompt. "Failed to create empty document". Is there any way to prevent this prompt. I am using the OpenDocumentFile (NULL) command to create the document view.
0
Comment
Question by:BlackRussian
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
galkin earned 240 total points
ID: 1313972
This message in generated as a result to failure in call inside CMultiDocTemplate::OpenDocumentFile to CreateNewFrame, which in turn calls CMDIChildFrame::Create. OpenDocumentFile function is virtual so you should override it to prevent this message box from being displayed.
0
 

Author Comment

by:BlackRussian
ID: 1313973
I'm am using Visual C++ ver 4.0 , CMultiDocTemplate doesn't show up as a deriveable class using class wizard. Can you explain how or show a code snippent ?.
0
 
LVL 7

Expert Comment

by:galkin
ID: 1313974
Yuo need manually derive class from CMultiDocTemplate and override virtual OpenDocumentFile function. also don't forget to change reference from  CMultiDocTemplate to your document template class inside CWinApp::InitInstance
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Screencast - Getting to Know the Pipeline

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question