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.

ProjectHookClass, ProjectHookLibrary

These properties tell you the pedigree of the default project hook for a given project.

Usage

cPHkClass = prjProject.ProjectHookClass
prjProject.ProjectHookClass = cPHkClass
cPHkLibrary = prjProject.ProjectHookLibrary
prjProjectHookLibrary = cPHkLibrary

Every project can have a project hook class associated with it, so that whenever the project is opened, a project hook of that class is created and linked to the open project. These properties tell you what that class is.

You can change these at runtime. However, you have to do it in the right order, which is library first, then class. When you change the class, VFP checks for a class of that name in the current ProjectHookLibrary. If there isn’t one or it has the wrong base class, VFP complains. If the project has no current project hook class and library, specifying the class first brings up the class selection dialog.

Changing these properties doesn’t change what project hook is associated with the project right now. If there’s already a project hook, it stays there. If the project didn’t have one, it still doesn’t. The new class is used the next time the project is opened.

Change either property to an empty string to free the project from its project hook the next time it opens.

Example

* Change the project hook class and library for
* the active project
_VFP.ActiveProject.ProjectHookLibrary = "MyLibrary"
_VFP.ActiveProject.ProjectHookClass = "MyProjectHook"

See Also

Project, ProjectHook, ProjectHook Property