Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Forcing Files to be included
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01150561
Message ID:
01153694
Views:
18
Hi Rick,

We had the same problem with our image files. We always forgot to include images into the project and then they were missing in the executable.

We solved it by creating a folder where we place the images that we want to have included in the exe.

A procedure that we run before compiling the exe picks up all files in that directory (called graphics\includedinexe) and adds them to the project.

You could expand that procedure to include any file that is found in the directory structure of the project.
So it is the diretory structure and where you place the files that ultimately determine which files will be included and not the code.
*-- Include any files from the includedinexe
*-- directory which are not yet in the project.
lnFiles = ADIR(laFiles, "Graphics\includedinexe\*.*")
loProject = _VFP.PROJECTS[1]
FOR lnNr = 1 TO lnFiles
	lcFileName = laFiles[lnNr,1]
	WAIT WINDOW "Scanning file " + lcFileName NOWAIT
	IF TYPE("loProject.FILES(lcFileName).NAME") <> "C"
		*-- So we need to include this file.
		loProject.FILES.ADD("Graphics\includedinexe\" + lcFileName)
	ENDIF
ENDFOR
>Hi all,
>
>I'm trying to figure out a way to reliable cause external files to be included into a project, but without having any control over the project (ie. can't use project hooks). The idea is that if somebody wants to use a class the associated resources get loaded into the project automatically just by including the class.
>
>I've found some ways to make this happen but it's all ugly as sin <g>. Basically I can add code like this:
>
>SET PROCEDURE TO MyJavaScriptResource.js
>SET PROCEDURE TO WebImage.gif
>
>and then never call this code.
>
>This actually works - the resources get included BUT the VFP compiler throws warning exceptions and creates a .ERR file at least for the JS file (oddly the compile completes though and the BUILD EXE reports 0 errors which seems strange - apparently the compile errors in non PRG files are ignored).
>
>Does anybody know of other ways that the VFP compiler will include external files explicitly?
Christian Isberner
Software Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform