Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

ActiveProject

This property of the Application Object gives you access to the most recently used open project.

Usage

oProject = appApplication.ActiveProject
appApplication.ActiveProject.Property = uValue
uValue = appApplication.ActiveProject.Property
appApplication.ActiveProject.Method()

Starting in VFP 6, you can manipulate projects programmatically. This property lets you figure out which one is on top so you can work with it. You access it through the _VFP variable or the Application Object.

Beware. If no projects are open, accessing this property triggers an OLE error. Be sure to test with TYPE() (not VARTYPE()) or _VFP.Projects.Count > 0 before using it unless you know there’s an open project.

Example

* Get a reference to the current project
oCurrentProj = Application.ActiveProject

* Display the name and last build date of the current project
?Application.ActiveProject.Name
?Application.ActiveProject.BuildDateTime

See Also

Application, Project, Projects, _VFP