Leser ikke fra ini fil
Jeg får ikke mitt script til å lese en key fra en INI fil.Declare Function GetPrivateProfileString Lib "Kernel32" Alias "GetPrivateProfileStringA" (ByVal sSection As String, ByVal sKey As String, ByVal sDefault As String, ByVal sReturn As String, ByVal lReturnSize As Long, ByVal sFilename As String) As Long
Declare Function WritePrivateProfileString Lib "Kernel32" Alias "WritePrivateProfileStringA" (ByVal sSection As String, ByVal sKey As String, ByVal sSetting As String, ByVal sFilename As String) As Long
Public Function CallINI(ByVal txtSection As String, ByVal txtKey As String, ByVal txtPath As String) As String
'Funktionen henter værdier fra inifil.
Dim sValue As String
Dim lSize As Long
Dim lTemp As String
Dim sDefault As String
'sValue = String(256, " ")
lSize = Len(sValue)
lTemp = GetPrivateProfileString(txtSection, txtKey, sDefault, sValue, lSize, txtPath)
If lTemp <> 0 Then
CallINI = sValue
Else
CallINI = sDefault
End If
End Function
Dette blir kalt med:
allINI("GENERAL", "ProgramFilePath", "C:\test.INI")