Occurs before a project is rebuilt or an application file (.app), dynamic link library (.dll), or executable file (.exe) is created from a project.
Syntax
PROCEDURE Object.BeforeBuild
[LPARAMETERS cOutputName, nBuildAction, lRebuildAll, lShowErrors, lBuildNewGuids]
Parameters
cOutputName
Specifies the name of the application, dynamic link library, or executable file that is created.
If cOutputName includes a file extension and nBuildAction is omitted, the file extension in cOutputName determines the type of file built. For example, if the extension in cOutputName is “.exe” an executable file is created.
nBuildAction
Specifies if the project is rebuilt or an application, dynamic link library, or executable file is created.
The following table lists the values for nBuildAction with a description of each.
nBuildAction | FoxPro.h constant | Description |
1 | BUILDACTION_REBUILD | Rebuilds the project. |
2 | BUILDACTION_BUILDAPP | Creates an .app. |
3 | BUILDACTION_BUILDEXE | Creates an .exe. |
4 | BUILDACTION_BUILDDLL | Creates a .dll. |
nBuildAction takes precedence over the file extension specified in cOutPutName. For example, an executable file is created if nBuildAction is 3 and cOutputName doesn't specify an “.exe” extension.
lRebuildAll
Specifies if files in the project are recompiled before an .app, .dll, or .exe is created. If lRebuildAll is true (.T.), the following are recompiled:
If lRebuildAll is false (.F.) or is omitted, files in the project are not recompiled before the .app, .dll, or .exe is created.
lShowErrors
Specifies if compilation errors are displayed in an editing window after the build is complete. If lShowErrors is true (.T.), the errors are displayed. If lShowErrors is false (.F.) or is omitted, compilation errors aren’t displayed.
lBuildNewGUIDs
Specifies if new registry GUIDs (globally unique identifiers) are generated when an executable file or dynamic link library is created. If lBuildNewGUIDs is true (.T.), new GUIDs are generated. If lBuildNewGUIDs is false (.F.) or is omitted, new GUIDs aren’t generated. lBuildNewGUIDs is ignored if nBuildAction is less than 3.
Remarks
The parameters listed above are passed to the BeforeBuild event when you execute the Build method, when you issue the BUILD APP, BUILD DLL, BUILD EXE, or BUILD PROJECT commands, or when you choose OK in the Build Options dialog box. The parameters are passed by reference with the exception of the nBuildAction parameter, which is passed by value. You can change the values of these parameters within the BeforeBuild event to change how a project, .app, .dll, or .exe is created from the project.
Include NODEFAULT in the BeforeBuild event to prevent a project from being rebuilt or an application file (.app), dynamic link library (.dll), or executable file (.exe) from being created.