[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

MFC App returns early after "Failed to create empty document dialogue". Debug output: No document names in string for template #(some number)

Posted on 2004-11-14
4
Medium Priority
?
2,384 Views
Last Modified: 2013-11-20
Hi,

I am using Visual C++ 6.0 and following a tutorial to create a simple Single Document Interface application (the URL for the section of the tutorial from which I am currently at is http://www.functionx.com/MFCFundamentals/Lesson05.htm). Following the instructions at that page, I created two resources - a menu and an icon and named them both IDR_MAINFRAME. I saved the script (and of course the corresponding resource header file was automatically generated).

However each time I launch the app, I get a "Failed to create empty document dialogue". When I debug, on the output pane I get the message:

Warning: no document names in string for template #101.
Warning: no document names in string for template #101.
Warning: failed to load menu for CFrameWnd.
Warning: CDocTemplate couldn't create a frame.

The InitInstance function of my code looks like this
BOOL CExerciseApp::InitInstance()
{
      CSingleDocTemplate* pDocTemplate;
      pDocTemplate = new CSingleDocTemplate(
            IDR_MAINFRAME,
            RUNTIME_CLASS(CExerciseDoc),
            RUNTIME_CLASS(CMainFrame),
            RUNTIME_CLASS(CExerciseView));
      AddDocTemplate(pDocTemplate);

      CCommandLineInfo cmdInfo;

      // Dispatch commands specified on the command line
      if (!ProcessShellCommand(cmdInfo))
            return FALSE;

      // The one and only window has been initialized, so show and update it.
      m_pMainWnd->ShowWindow(SW_SHOW);
      m_pMainWnd->UpdateWindow();

      return TRUE;
}

I found a similar query on experts-exchange and one of the experts recommended creating a string table and making entries for the the template number IDs with any caption. However this has not solved the problem in my case.

Thanks.
0
Comment
Question by:actionjackson88
  • 2
  • 2
4 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12580240
You need to create a IDR_MAINFRAME string resource also. It is needed by CSingleDocTemplate, and is generated automatically when you use the AppWizard tool. Try to create a string like this:

"Exercise\n\nExercise\n\n\nExercise.Document\nExercise Document"
0
 

Author Comment

by:actionjackson88
ID: 12581825
hi, thanks for the advice.

please forgive my ignorance, but exactly how do i do this?

do i put this string resource in the string table and use that string you wrote as a caption?
0
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 1000 total points
ID: 12583497
IDR_MAINFRAME is the string identifier (without quotes please)
string posted is the string content
0
 

Author Comment

by:actionjackson88
ID: 12586036
thank you
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses
Course of the Month20 days, 2 hours left to enroll

872 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