Application, _VFP

We considered putting "Application" twice in the heading above because Application is one of the many FoxPro keywords with more than one meaning. It's both a property and an object. Both refer to a VFP automation server, though. _VFP is a system variable that provides a reference to the Automation server.

Usage

Application.Property = uValue
_VFP.Property = uValue
uValue = Application.Property
uValue = _VFP.Property
Application.Method()
_VFP.Method()
Since VFP 5, VFP is an Automation server and has the ability to create custom Automation servers. What this means is that other applications can call on VFP and the servers you build with it, and tell them to do things. The Application object and the _VFP system variable both provide an object reference to the server object, letting you address it from within VFP.In the development environment, we don't need to use these two too much. When we do, we tend to use _VFP rather than Application, because it's so much shorter to type. Most often these days, we use _VFP to grab the ActiveProject so we can check out all the new capabilities on that front. Another item you might want to mess with is _VFP.StatusBar, which controls the text on the status bar. Starting in VFP 7, there are a few other properties you might need to deal with. The positioning properties (Top, Left, Height and Width) for _VFP are no longer the same as for _SCREEN. _VFP's properties refer to the entire VFP area, while _SCREEN's measure only the interior, client area. In addition, both _VFP and _SCREEN now have an hWnd property that provides a Windows handle to the application and its client window, respectively. With IntelliSense, it's easier to explore the new properties or underused functions, such as EditorOptions or DataToClip().In custom servers, these references are more important because they let you tailor the VFP environment in which the server lives.

Example

oProj = _VFP.ActiveProject  && Grab a reference.
Application.Top = 35        && Position VFP
Application.Height = 100    && and size it.

Usage

oApp = oObject.Application
Application is also a property of every VFP base class. It contains a reference to the VFP application object that holds the object.

Example

o = CreateObject("Form") && Create a form.
? o.Application.Name     && Returns "Microsoft Visual FoxPro".

See Also

ActiveForm, ActiveProject, AutoYield, Caption, DataToClip, DefaultFilePath, DoCmd, EditorOptions, Eval, Forms, FullName, Height, Help Method, hWnd, LanguageOptions, Left, Name, Objects, OLERequestPendingTimeout, OLEServerBusyRaiseError, OLEServerBusyTimeout, Parent, ProcessID, Projects, Quit Method, RequestData, _Screen, ServerName, SetVar, StartMode, StatusBar, ThreadID, Top, Version, VFPXMLProgID, Visible, Width


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .