Microsoft KB Archive/200294

= BUG: Cannot Use LoadPicture with Images Included in Project =

Article ID: 200294

Article Last Modified on 8/27/2002

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q200294



SYMPTOMS
When you call the LoadPicture function from within a Visual FoxPro .app or .exe program, and you use a file name that is the same as one that is included in the project, you may receive the following OLE error:

OLE error code 0x800a01e1: Unknown COM status code.



CAUSE
Visual FoxPro first looks at the files that are included in the project, and then calls application programming interfaces (APIs) that do not handle embedded files.



RESOLUTION
Change file names so that the LoadPicture function is not called with names that are included in the project. You can do this manually by using different names for your files, or programmatically at run time by using code like the following: LOCAL lcOldFile, lcNewFile lcOldFile = "D:\graphics\picture1.bmp" lcNewFile = JUSTPATH(lcOldFile) + SYS(3) + ".bmp" RENAME (lcOldFile) TO (lcNewFile) x = LOADPICTURE(lcNewFile) RENAME (lcNewFile) TO (lcOldFile) NOTE: The JUSTPATH function was introduced in Visual FoxPro 6.0.



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



Steps to Reproduce Behavior
 Create an empty project named Test.  Add a new program that contains the following line of code to the project: x = LOADPICTURE(GETFILE)  Add a bitmap named Picture1.bmp to the project. Build the project to an executable named Test.exe. Copy both Test.exe and Picture1.bmp to a test folder, and then run Test.exe.</li> When prompted, select Picuture1.bmp. You should received the OLE error that is shown in the "Symptoms" section.</li></ol>

<div class="references_section">