C0000005 fatal error with invalid property name in Visual FoxPro (221734)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 6.0

This article was previously published under Q221734

SYMPTOMS

You receive the following error mesage and Visual FoxPro exits:
Fatal error: Exception code = C0000005
This behavior occurs when attempting to access an invalid property of an object.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

This bug was corrected in Visual Studio 6.0 Service Pack 3. For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:

194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed

MORE INFORMATION

Steps to reproduce the behavior

The following steps require Microsoft Outlook to be installed on the computer that is running Visual FoxPro.
  1. Create a program named Getitems.prg using the following code:
       oTraverse = CREATEOBJECT("traverseoutlook")
       oTraverse.BeginTraverse
    
       DEFINE CLASS TraverseOutlook AS CUSTOM
          nNestingLevel = 0
          oOutLookObject = NULL
          olNameSpace = NULL
    
          PROCEDURE INIT
             WITH THIS
                .oOutLookObject = CREATEOBJECT("Outlook.Application")
                .olNameSpace = .oOutLookObject.GetNameSpace("MAPI")
             ENDWITH
          ENDPROC
    
          PROCEDURE BeginTraverse
             LOCAL folder
             FOR EACH folder ;
                   IN THIS.olNameSpace.Folders
                THIS.ProcessFolder(folder)
             NEXT folder
          ENDPROC
    
          PROCEDURE ProcessFolder(subfolder)
             * The valid property is THIS.nNestingLevel
             THIS.NestingLevel = THIS.NestingLevel + 1
             ?REPLICATE(CHR(9),THIS.NestingLevel-1),subfolder.NAME
             FOR EACH folder IN subfolder.Folders
                THIS.ProcessFolder(folder)
             NEXT folder
             FOR EACH ITEM IN subfolder.Items
                ?REPLICATE(CHR(9),THIS.NestingLevel),ITEM.subject
             NEXT ITEM
             THIS.NestingLevel = THIS.NestingLevel - 1
          ENDPROC
       ENDDEFINE
    						
  2. In the Command window, type the following:
    DO GETITEMS
    					
  3. Visual FoxPro terminates after displaying the following error message:
    Fatal error: Exception code = C0000005
  4. Replace the ProcessFolder (subfolder) code with the following code:
       THIS.nNestingLevel = THIS.nNestingLevel + 1
       ?REPLICATE(CHR(9),THIS.nNestingLevel-1),subfolder.NAME
       FOR EACH folder IN subfolder.Folders
          THIS.ProcessFolder(folder)
       NEXT folder
        FOR EACH ITEM IN subfolder.Items
          ?REPLICATE(CHR(9),THIS.nNestingLevel),ITEM.subject
       NEXT ITEM
       THIS.nNestingLevel = THIS.nNestingLevel - 1
    						
  5. In the Command window, type the following:
          DO GETITEMS
    					
  6. Note that Visual FoxPro outputs information to the screen as the Outlook folder hierarchy is traversed.

Modification Type:MajorLast Reviewed:1/27/2005
Keywords:kbAutomation kbBug kbfix kbOOP kbVS600SP1fix kbVS600sp2fix kbVS600sp3fix KB221734 kbAudDeveloper