Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inserting a date into exe at compile time
Message
 
 
To
02/06/2008 01:17:17
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01317866
Message ID:
01320923
Views:
23
* The project name is Testproj
* You should keep a ProjectHook in the seaprate class library 
*		and do not include it in the project
CREATE CLASSLIB TestprojPH
CREATE CLASS TestprojPH OF TestprojPH AS ProjectHook

* Put following code into the BeforeBuild event
* --- BeforeBuild Start ---
LPARAMETERS cOutputName, nBuildAction, lRebuildAll, lShowErrors, lBuildNewGuids
LOCAL loProj 
lcDate = TTOC(DATETIME())
loProj = _VFP.ActiveProject
loProj.VersionComments = "Project Built on " + lcDate 
* --- BeforeBuild End ---
* Close Class Designer

* Assign the ProjectHook to the project
* It can be done through the Project Manager (PM) or Project object
Modify project Testproj
ooo = _VFP.ActiveProject
ooo.ProjectHookLibrary = "TestprojPH"
ooo.ProjectHookClass = "TestprojPH"

* Make sure that VersionNumber is populated, 
*	otherwise the PM will not create Version* items
? ooo.VersionNumber
* If it's empty, set it to something 
* ooo.VersionNumber = "1.0.0"
ooo.Build(2)
? ooo.VersionComments
* release Project object
ooo = NULL
>>>
>>>I would like to hard code the date into my exe when I compile it so that the exe contains the date it was compiled on. Or actually, any date that I choose. Can I do that?
>>
>>Jos,
>>
>>You can use a ProjectHook and update whatever you want in its BeforeBuild event. For example, you can use projects VersionComments property to store the info.
>
>I've never tried this Sergey. Can you give me the starting steps in the right direction.
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform