Wiki Home

Project Hook Uses

(Updated: 2005.04.28 04:18:25 PM)
Namespace: VFP
This month's FoxPro Advisor (October 2002) got me thinking about project hook uses. I always get the feeling that I am not using them to their full potential (I feel the same about Intellisense). Some of the uses included in this issue were:

- A hook that can launch files not normally supported by the project manager (eg. Word documents, Excel, etc.)

- Ensuring all files are marked read/write (when used with source control) during a build.

- A hook that makes sure all components of a system are built.

Rick Schummer wrote a project hook app. (at http://www.rickschummer.com) that (among other things):

- Handles versioning

- Stripping VFP reports so that they don't include the printer info.

- Different build types (dev. or "gold")

- Automatic field mapping to different subclasses

What types of uses have other developers come up with for project hooks? I know VFE makes use of them; can anyone more familiar with the framework explain how?


-- Paul Mrozowski

This one is a little out there, but useful to me. One session that I give involves both using and showing some class libraries. I've built the whole session into an app, but that means that some of the classes I need to open (MODI CLASS) are in use. So, I created a project hook using After Build (or maybe, BeforeBuild - it's been a while since I looked at this) that creates a table listing all the VCX's in the project. Then, at runtime, one of the first steps is to use this table as a driver to make a temporary copy of each VCX that I can display during the session. The code that displays VCX's uses the table to find the name of the temp VCX. -- Tamar Granor
---

I make backups of every file I open in the querymodifyfile method. Sometimes a class is in memory when I attempt to make a backup which results in an error, but I think this is good because classes have become corrupted when they are already in memory and are opened for editing. BTW clear classlib does not reliably remedy a class/classlib being in memory. Does anyone know of a way to reliably get classib out of memory; so that one by write to the vcx/t?

I also use the hook to always set safety ON when building an EXE so that I am always prompted to confirm over-writes. The hook is also used to prompt an extra time when building to a network distribution folder, "Geek! are you sure?".

The hook is also used to archive release notes in the project. The hook looks for a file named release notes.txt, renames it [release notes]+APPLICATION.ACTIVEPROJECT.VERSIONNUMBER+[.txt] and adds the renamed file to the project. These release notes are burned into the EXE and displayed in the app's about dialogue.

Pretty soon the project hook may put me out of work!

-- Brett Carraway

Since FoxPro 2.0 I have been copying the exe from my development folder to the application folder by using "!copy this.exe \application folder\this.exe". I created a class based on the project hook and placed this code in the .afterbuild method. As soon as the exe is created it is copied to the application folder, ready for testing.

-- Jeff Johnson
For vfp web apps! In the BeforeBuild, you can either unload the VFP web app or stop start iis so there's no problem with locking and compiles. Active VFP makes extensive use of this...
-- Claude Fox
See also: Project Hook Project Hook Examples
Category VFP IDE