Link to home
Start Free TrialLog in
Avatar of actionjackson88
actionjackson88

asked on

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

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.
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

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"
Avatar of actionjackson88
actionjackson88

ASKER

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?
ASKER CERTIFIED SOLUTION
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thank you