By example, the following code works in a VB module, but I can't use it in a VBScript.
The error always occurs during the declaration of the API:
- Line : 3
- Caract : 17
- Code : 800A0401
- Source : Compilation Error
So, I don't know if I can use the Windows API
Thanks for your answer
--------------------------------------------------
Option Explicit
Private Declare Function GetPrivateProfileString& Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String)
MsgBox(LireKeyIni("mySection","myKey","myFile"

)
Public Function LireKeyIni(section$, key$, file$)
Dim N, valeur$
valeur = String(255, 0)
N = GetPrivateProfileString(section, key, "", valeur, 254, file)
If N > 1 Then
valeur = Left$(valeur, N)
End If
LireKeyIni = valeur
End Function
----------------------------------------------