Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
.ini files
Message
De
09/10/1996 12:37:44
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:
00009704
Vues:
31
>>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
>

Thanks.... I tried to use these and have a few questions...
1. Where can I get info on these dll functions?
2. When I tried to use them I got a few errors...
- it bombed on the 'tcFile=IIF...' line in the GetIni function...I'm not following what you're doing .... the oApp.Inifile does not exist..
- I commented out that line... then it bombed on =GetPrivateProfile....it said it had too many arguments......????? Any help is greatly appreciated... BTY... the univeral thread is a great learning tool.. thank you...
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform