Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Vfp5.0 ini files
Message
De
21/04/1997 20:10:59
 
 
À
21/04/1997 20:07:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00029034
Message ID:
00029193
Vues:
41
>Michel, I find the discussion enteresting but, could you please give me an example of how to use an INI file?

This is from my framework.

FUNCTION GetIni
* Return the value from an INI file
* expC1 Section
* expC2 Key
* expC3 INI file
PARAMETER tcSection,tcKey,tcFile
PRIVATE lcBuffer,lnLocation
tcFile=IIF(TYPE('tcFile')<>'C',oApp.IniFile,tcFile)
lcBuffer=SPACE(40)+CHR(0)
=GetPrivateProfileString(tcSection,tcKey,'',@lcBuffer,LEN(lcBuffer),tcFile)=0
lnLocation=AT(CHR(0),lcBuffer)
IF lnLocation>0
lcBuffer=SUBSTR(lcBuffer,1,lnLocation-1)
ENDIF
RETURN lcBuffer

FUNCTION WriteIni
* Save an entry in an INI file
* expC1 Section
* expC2 Key
* expC3 Value
* expC4 INI file
PARAMETER tcSection,tcKey,tcValue,tcFile
tcFile=IIF(TYPE('tcFile')<>'C',oApp.IniFile,tcFile)
=WritePrivateProfileString(tcSection,tcKey,tcValue,tcFile)

And, you need to put this on top of your master program.

* DECLARE DLL statements for reading/writing to private INI files
DECLARE INTEGER GetPrivateProfileString IN Win32API;
String cSection,String cKey,String cDefault,String @cBuffer,;
Integer nBufferSize, String cINIFile

DECLARE INTEGER WritePrivateProfileString IN Win32API;
String cSection,String cKey,String cValue,String cINIFile

Little adjustement, like oApp.IniFile, need to be done in order to run it.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform