Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
#DEFINE - Why?
Message
From
31/03/2008 01:42:16
 
 
To
30/03/2008 19:48:52
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01306848
Message ID:
01306864
Views:
10
>What is the simplest explanation as to why these are needed? Why not just set regular variable values? So what if they are constant and don't change?

Here's one thing they're useful for:

Suppose you have an application you're selling, to multiple registered companies/users and in multiple languages. #DEFINEs let you do this without changing your source code.
#INCLUDE Language.h
#INCLUDE CompanyInfo.h

...

[Language_ENU.h]
#DEFINE SomeCharString "English Message"

[Language_ESP.h]
#DEFINE SomeCharString "Spanish Message"

[Company1Info.h]
#DEFINE CompanyName "Some Company"

[Company2Info.h]
#DEFINE CompanyName "A Different Company"

* To regenerate your application for Company2 in Spanish:
- Overwrite Language.h with Language_ESP.h
- Overwrite CompanyInfo.h with Company2Info.h
- Recompile All, et voila !
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform