How To Use Config.fpw Files with OLE Automation Servers

Last reviewed: October 29, 1996
Article ID: Q157402
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 5.0

SUMMARY

This article describes how to reference specific configuration variables when Visual FoxPro is set up as an OLE Automation Server. When you define an OLE server, you can either reference the Visual FoxPro Application object or create custom OLE classes. These two types of OLE objects require different methods to read environment settings.

MORE INFORMATION

Visual FoxPro exposes FoxPro as an OLE server. The Application object provides the top level of the hierarchy. For example, in an OLE client application, you can run the following command to create an OLE object:

   CREATEOBJECT("VisualFoxPro.Application")

If you are referencing the VisualFoxPro.Application object, the normal configuration file conventions are adopted since an instance of Vfp.exe is launched (assuming you use CreateObject() and not GetObject()). This means it references the Config.fpw file in the default directory, or you can add to a registry key the -C startup switch that specifies the path to the Config.fpw file. The registry key to modify follows:

   HKEY_CLASSES_ROOT\CLSID\{GUID}\LocalServer32

The GUID is different for every install of Visual FoxPro. The Value of this key is as follows:

   C:\VFP5\VFP.EXE /automation -CC:\CONFIG.FPW

When you create your own custom OLE Automation servers, the OLE classes you create are delivered in either a .dll or an .exe file. Before you build the .exe or .dll, add the Config.fpw file into the project and make sure it is marked as included. At run time, the Config.fpw that resides inside of the .exe or .dll file is used.

To specify a different Config.fpw file once an OLE Automation Server is distributed, you can use the same procedure as above and modify the registry key for the OLE server.

NOTE: If you have included the Config.fpw file in the project, the -C switch is ignored.


KBCategory: kbusage kbprg kbinterop kbole kbhowto
KBSubcategory: FxenvConfigfp
Additional reference words: 5.00 kbdse VFoxWin



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 29, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.