Solved

failed to create empty document

Posted on 1997-07-13
9
1,636 Views
Last Modified: 2013-11-20
I have developed an application on Windows 95 (MFC 4.0).
Now I started my program on  Win 3.11, but I get the
errormessage  'failed to create empty document'.
I get the message after the ProcessShellCommand(cmdInfo) call in initInstance().

I have found that I get the message because the CFrameWnd::OnCreate(lpCreateStruct) function returns the value -1.
But I don't know why.



0
Comment
Question by:pneumann
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 1

Expert Comment

by:TKII
ID: 1302541
Your program is a 32 bit program (Win95, VC++4.0) that cannot run under Win3.11. Or is there something you didn't told us?
0
 

Author Comment

by:pneumann
ID: 1302542
I use win32s on Win 3.11 !!!!
I have developed already programms with VC++ 4.0 and they
run under Win3.11 without problems.

0
 
LVL 1

Expert Comment

by:TKII
ID: 1302543
Please let us have a look at some code (e.g. InitInstance).
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:pneumann
ID: 1302544
Here the following code:
The application consist of an CFormView and some CDialogs which
are called from the menu or with buttons from the CFormView dialog resource. Is it possible that there is a connection between the error and the MAINFRAME menu configuration?

BOOL CMessungApp::InitInstance()
{
      // Standard initialization
      // If you are not using these features and wish to reduce the size
      //  of your final executable, you should remove from the following
      //  the specific initialization routines you do not need.

      CFrameWnd* pFrame = NULL;

      SetRegistryKey("Messung und Sortierung");

      LoadStdProfileSettings();  // Load standard INI file options (including MRU)

      // Register the application's document templates.  Document templates
      //  serve as the connection between documents, frame windows and views.

      CSingleDocTemplate* pDocTemplate;
      pDocTemplate = new CSingleDocTemplate(
            IDR_MAINFRAME,
            RUNTIME_CLASS(CMessungDoc),
            RUNTIME_CLASS(CMainFrame),       // main SDI frame window
            RUNTIME_CLASS(CMessungView));
      AddDocTemplate(pDocTemplate);

      // Parse command line for standard shell commands, DDE, file open
      CCommandLineInfo cmdInfo;
      
      ParseCommandLine(cmdInfo);

      // Dispatch commands specified on the command line
         if (!ProcessShellCommand(cmdInfo))
            return FALSE;
       
        // ProcessShellCommand() return FALSE ??!!!
        // after displaying "failed to create empty document"        

      OpenDocumentFile("messung.dat");
      
      return TRUE;
}

0
 
LVL 1

Expert Comment

by:TKII
ID: 1302545
Maybe your error has something to do with this line:

CFrameWnd* pFrame = NULL;

In my projects there are this lines that create the main frame window.

CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
     return FALSE;
m_pMainWnd = pMainFrame;

Try to create a new project with appwizzard and compare the InitInstance() with the one you have.
0
 

Author Comment

by:pneumann
ID: 1302546
Sorry, but I tried it, and I get the same output.
But now I have found the failure !!!!!

I use a CFormView with an attached dialog, and in the dialog
there was an TextItem and I have enabled the Static edge in the
Extended Styles. This works only on win95.

Normaly a message appears that an unsupported component was found.
But in this case it does not !! ???

0
 
LVL 1

Expert Comment

by:TKII
ID: 1302547
ok that's fine. Don't forget to set the points for your question to 0 and send a mail that your question can be removed.
0
 
LVL 1

Expert Comment

by:TKII
ID: 1302548
ok that's fine. Don't forget to set the points for your question to 0 and send a mail that your question can be removed.
0
 
LVL 8

Accepted Solution

by:
gelbert earned 20 total points
ID: 1302549
Usually this message is displayed when something went wrong in CSingleDocTemplate constructor like it can not find menu or create toolbar in OnCreate. So check if IDs in your resource file match IDs in the rest of the code.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

749 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