定义:
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
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
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货