• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 277
  • Last Modified:


I have the following problem with my MFC SDI application:
Everything works fine in WIN98 (I am running VSTUDIO in WIN98) but when I have tried in WIN NT I got the following dialog box  "Failed to create empty document" and nothing more.

I have find the peace of code that is doing this:

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

This has been written by MFC APP WIZARD so what is the problem!?

Thanks in advance for everyone that reads this and sorry about my English :-)
1 Solution
jmartins71Author Commented:
Sorry about the title but I forgot to complete it :-)
This error message means exactly what it says: MFC has tried to create a new, empty document and has failed doing so.

There are a few causes to this problem:

1) The CDocument constructor has thrown an exception.

2) The CDocument was created, but the associated CView's constructor has thrown an exception.

3) The CView C++ object was created successfully, but for some reason the window associated with the CView could not be created. There are several possible causes:

3a) Not enough memory.

3b) A class the view wants to use isn't registered. For example, you have a CRichEditView but you never called AfxInitRichEdit() to get the rich edit control loaded and registered.

3c) An OLE object the view wants to use isn't registered. For example, you have a CFormView with an OLE control in it and that OLE Control isn't registered.

Exactly which cause you're exactly experiencing is determined by debugging the application.

..B ekiM

Are you using MFC as statically linked?
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

jmartins71Author Commented:
shaig: "Are you using MFC as statically linked?
"  - YES

1) 2) If is someone of this why does this not happens on WIN98!? I have tested in several computers with WIN98!

3a) something

3b 3c  I am going to try to do oleinitialize/oleuninitialize (I will send one comment of the result)

I am not using components and my views are:
1)LeftView from CView
splitted with
2)ContainerView from CView

In the containerview I have two splitted views:
1)ListView from CListView
2)InfoView from CView

jmartins71Author Commented:
"I am going to try to do oleinitialize/oleuninitialize "

Since I do not have VStudio in the NT computer the debug is harder!

jmartins71Author Commented:
Adjusted points to 220
jmartins71Author Commented:
I have found the offending code:

In my LeftView::OnCreate I have:
 // Create the pager control and set its parent to 'this'
      if (!m_Pager.Create(WS_CHILD|WS_VISIBLE|PGS_VERT,
            CRect(0,0,0,0), this, IDC_STATIC ))
            TRACE0("Failed to create CPagerCtrl...\n");
            return -1;

and the create fails.
the create is:
CWnd* pWnd = this;

    if (pWnd->Create(WC_PAGESCROLLER, NULL, dwStyle, rect, pParentWnd, nID))
        return TRUE;

    return FALSE;

Why does this happens I do not know!
Can someone help me!
jmartins71Author Commented:
Just to complete the last comment:

m_Pager is:

// CCJPagerCtrl is a CWnd derived class which wraps the windows
// Pager common control.
class CCJPagerCtrl : public CWnd

this code is from www.codeguru.com

And this works in WIN98! My NT computer has 128M of RAM!
jmartins71Author Commented:
MIKEBLAS I am just rejecting in order to reopen the question
I am familiar with the CCJPagerCtrl. It wraps the Pager control that was introduced with comctl32.dll v4.71 (which was part of IE4).

Check the version of this DLL on the NT PC (it's in C:\WINNT\SYSTEM32). If it's less than 4.71, that's the problem.

To resolve this, you can download the latest version of comctl32.dll from the microsoft web site. Search for 50comupd.exe.
jmartins71Author Commented:
Abancroft: you are probably wright.

I have run it in NT with SP1
I ask a friend with NT SP5 and everything went well.

I am going to try to find the comctl32.dll

As your answer give me the good way to follow I will accept your comment as my answer

Thank you

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now