定义:
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然后再vb中
写了如下的程序:
Public Sub ReadIniFile()
Dim str As String * 255, s As String
Dim str1 As String
Dim count As Integer
count = GetPrivateProfileString("server", "path", "", str, 255, "test.ini")
str1 = Left(str, count)
Debug.Print str1
End Sub这样写对吗
我的ini如下:
[server]
path = 123希望的结果事str1 = 123