Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Reading an INI file
Message
De
13/02/1999 11:37:38
 
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00187229
Message ID:
00187378
Vues:
18
>>Any sample on reading an INI file?
>>
>>I would like to read some parameters that I created in a small INI file.
>
>Give this sample a try:
>
>Declare Function GetPrivateProfileString Lib "kernel32" _
> Alias "GetPrivateProfileStringA" _
> (ByVal lpApplicationName As String, _
> ByVal lpKeyName As Any, _
> ByVal lpDefault As String, _
> ByVal lpReturnedString As String, _
> ByVal nSize As Long, _
> ByVal lpFileName As String _
> ) As Long
>
>Public Function ReadFromINI(ByVal pSection As String, _
> ByVal pKey As String, _
> ByVal pDefault As String, _
> ByVal pPath As String _
> ) As String
>Dim lngReturn As Long
>Dim strReturn As String
>
> strReturn = String$(200, 0)
> lngReturn = GetPrivateProfileString(pSection, pKey, pDefault, strReturn, Len(strReturn), pPath)
> ReadFromINI = Left$(strReturn, lngReturn)
>End Function
>
>
>You can call it this way:
> MyVariable = ReadFromINI("ODBC", "DB-SERVER", "GAA-ERREUR", App.Path & "\GAA.INI")
>
>You can also take a look at WritePrivateProfileString function that write to an INI file.

Thanks, I'll try that this afternoon
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform