CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2005
    Location
    Bay Area, CA
    Posts
    110

    Why would CreateObject() fail

    and give me "Fail to create empty document" message?

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Why would CreateObject() fail

    Debug your App, step in in the code to see what could be the cause and where (in which module).

  3. #3
    Join Date
    Jun 2005
    Location
    Bay Area, CA
    Posts
    110

    Re: Why would CreateObject() fail

    I did and after stepping into the function of ProcessShellCommand(cmdInfo) it is failing inside the function CreateObject.

    Code:
       // Dispatch commands specified on the command line
       if (!ProcessShellCommand(cmdInfo))
       {
          pSystemLog->LogMessage("Failure in ProcessShellCommand dispatch for command line arguments.",LOG_LEVEL_ERROR);
          return FALSE;
       }

    Code:
    CObject* CRuntimeClass::CreateObject()
    {
    	if (m_pfnCreateObject == NULL)
    	{
    		TRACE(traceAppMsg, 0,
    			_T("Error: Trying to create object which is not ")
    			_T("DECLARE_DYNCREATE \nor DECLARE_SERIAL: %hs.\n"),
    			m_lpszClassName);
    		return NULL;
    	}
    
    	CObject* pObject = NULL;
    	TRY
    	{
    		pObject = (*m_pfnCreateObject)();
    	}
    	END_TRY
    
    	return pObject;
    }
    All of this is causing the application to get an error message "Failed to create empty document"

  4. #4
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: Why would CreateObject() fail

    Have you modified something/anything in the Doc,View or the frame class ??

    Can you post the project here ?
    Regards,
    Ramkrishna Pawar

  5. #5
    Join Date
    Apr 2001
    Location
    Tampa Florida
    Posts
    233

    Re: Why would CreateObject() fail

    Hello
    I know this is too old to help but for future reference:

    When I get a fail to create it is usually because I have deleted something
    from a dialog without deleting the associated variable .

    Unlike your example I usually get an nID error inside the MS assert codes
    which will point to something in the rc file. Any references to the number and to the associated pneumonic (ID_Button) have to be removed.

    Best Regards
    "trampling out the vintage"

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Why would CreateObject() fail

    Quote Originally Posted by JohnDavidHanna
    Hello
    I know this is too old to help but for future reference:

    When I get a fail to create it is usually because I have deleted something
    from a dialog without deleting the associated variable .

    Unlike your example I usually get an nID error inside the MS assert codes
    which will point to something in the rc file. Any references to the number and to the associated pneumonic (ID_Button) have to be removed.

    Best Regards
    That pretty clearly isn't the case here.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured