Article ID: 258530 - Last Review: August 7, 2007 - Revision: 1.2

FIX: Multiple References to File Object of Project Causes OLE Error

System TipThis article applies to a different operating system than the one you are using. Article content that may not be relevant to you is disabled.
This article was previously published under Q258530
Expand all | Collapse all

SYMPTOMS

When obtaining multiple references to an object in the Project.Files collection, you may receive the error message:
OLE Exception error: Exception code c0000005. OLE object may be corrupt.

RESOLUTION

A workaround in builds of Visual FoxPro 6.0 prior to Visual Studio Service Pack 4 is to refer to the objects in the Files collection by number instead of name. The following code does not produce the exception error in Visual Studio Service Pack 3 and earlier:
*Start of Code
MODIFY PROJECT proj1 NOWAIT NOSHOW
loFile = Application.ActiveProject.Files(1)
? VARTYPE(loFile)            && Should be "O" for object
RELEASE loFile
loFile = Application.ActiveProject.Files(1)
*End of Code
				

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 the latest service pack for Visual Studio 6.0.

For additional information about Visual Studio service packs, click the following article numbers to view the articles in the Microsoft Knowledge Base:
194022  (http://support.microsoft.com/kb/194022/EN-US/ ) INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295  (http://support.microsoft.com/kb/194295/EN-US/ ) HOWTO: Tell That a Visual Studio Service Pack Is Installed
To download the latest Visual Studio service pack, visit the following Microsoft Web site:
http://msdn2.microsoft.com/en-us/vstudio/Aa718353.aspx (http://msdn2.microsoft.com/en-us/vstudio/Aa718353.aspx)

MORE INFORMATION

  1. Create a new project called Proj1.
  2. Add an empty file to the Code tab called MyProg.prg.
  3. Type the following code into the Command Window:
    MODIFY PROJECT proj1 NOWAIT NOSHOW
    loFile = Application.ActiveProject.Files("myprog.prg")
    ? VARTYPE(loFile)            && Should be "O" for Object
    RELEASE loFile
    loFile = Application.ActiveProject.Files("myprog.prg")
    After running the code, you receive the error message listed in the "Symptoms" section.

APPLIES TO
  • Microsoft Visual FoxPro 6.0 Professional Edition
Keywords: 
kbbug kbcodesnippet kbfix kbprojmanager kbvs600sp4fix kbvs600sp5fix KB258530
Retired KB ArticleRetired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.