Microsoft KB Archive/258530

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

Article ID: 258530

Article Last Modified on 8/7/2007

-

APPLIES TO


 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q258530



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 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 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



MORE INFORMATION
 Create a new project called Proj1 . Add an empty file to the Code tab called MyProg.prg .  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. 

Additional query words: sp4

Keywords: kbbug kbcodesnippet kbfix kbprojmanager kbvs600sp4fix kbvs600sp5fix KB258530

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.