Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
.ini files
Message
De
03/10/1996 14:50:43
Paul Baker
Pacific Environmental Services, Inc.
Rtp, Caroline du Nord, États-Unis
 
 
À
02/10/1996 16:54:49
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Divers
Thread ID:
00009177
Message ID:
00009295
Vues:
34
>>Where can I find info on using .ini files with VFP. I have some configuration info (pathes, etc.) that I am now keeping in a 1 record dbf. I would like to use an .ini file.... Will that approach work????? thanks...
>
>Here's two functions to read and write in INI files.
>
>
>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, here's what you need in top of your master program to declare those DLL functions
>
>
>* 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
>


Once again... thank you...
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform