Microsoft KB Archive/162081

= PRB: In-Process Server Fails on CREATEOBJECT in VFP Run Time =

Article ID: 162081

Article Last Modified on 8/6/1999

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0 Standard Edition

-



This article was previously published under Q162081



SYMPTOMS
Doing a CREATEOBJECT on a Visual FoxPro in-process OLE-server inside a Visual FoxPro run-time application gives the following error messages:

Windows 95: "This program has performed an illegal operation and will be shut down"

Windows NT: "The instruction at referenced memory at . The memory could not be read"



CAUSE
The run-time .exe file and the in-process OLE-server .dll file are using the same instance of Vfp500.dll, which has global variables that have different values depending on whether it is called from a .dll file or an .exe file.



RESOLUTION
NOTE: Your .exe file and your in-process server .dll file need to be in different folders, and each needs its own set of Visual FoxPro run-time files.

  Copy the following Visual FoxPro runtime files from your System folder(System32 on NT) into the directories where your .exe file and .dll file are located: Vfp500.dll Vfp5enu.dll (Last three letters change with localized versions)  Delete the Visual FoxPro run-time files from of your System folder.

Step 2 is required because Visual FoxPro looks in the System folder before looking in the current folder. VFP 5.0a does not need Step 2 because the stub loader looks in the current folder for Vfp500.dll.



Steps to Reproduce Behavior
 Create a project called Myserver1. Add a new program file to the project.  Enter the following code in the program file: DEFINE CLASS oleserver as custom OLEPUBLIC FUNCTION Hello RETURN "Hello World" ENDFUNC ENDDEFINE </li> Save the program and build the project as an OLE DLL. (Click the Build button in the Project Manager, then select Build OLE DLL from Build Options, and then click OK.)</li> Create a project called Main.</li> Add a new program file to the project.</li>  Enter the following code in the program file: oMyServer = CREATEOBJECT("myserver1.oleserver") s = oMyServer.Hello WAIT WINDOW s                           </li> Save the program and build the project as an executable. (Click the Build button in the Project Manager, then select Build Executable from Build Options, and then click OK.)</li> Shut down the Visual FoxPro IDE and run the Main.exe you created in step 8 (from the Windows Explorer double-click the Main.exe).</li></ol>

Keywords: kbenv kbprb KB162081

-

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

© Microsoft Corporation. All rights reserved.