Click to See Complete Forum and Search --> : "Failed to Create Empty Document" Error


amit_ra
February 24th, 2003, 01:01 AM
Hi,

I am trying to create a simple SDI application using MFC.
My programme is compiling correctly but when i am trying to execute it i get an error "Unable to Create empty Document" . The following is the code i used in my Application class InitInstance method...

BOOL C_CustomApp::InitInstance()
{
CSingleDocTemplate* pDocTemplate;
pDocTemplate= new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(C_CustomDoc),
RUNTIME_CLASS(C_MainFrame),
RUNTIME_CLASS(C_CustomView));
AddDocTemplate(pDocTemplate);
EnableShellOpen();
RegisterShellFileTypes();

if(m_lpCmdLine[0] == '\0')
{
OnFileNew();
}
else
{
OpenDocumentFile(m_lpCmdLine);
}
m_pMainWnd->DragAcceptFiles();
return TRUE;
}

I am getting the error on the call of 'OnFileNew' function.

What is it that i am doing wrong . Please help.

Thanks..