又有问题啦,列表框写INI的问题!在线坐等 求解··
我想把列表框的项目内容 写入INI,写进键值位置, 每项的值 用"|" 隔开
这个有点难度 ,希望高手,懂的,大虾来帮下
我一点头绪都没有 ,希望有代码 来给予思考 谢谢!!
'------------BAS 里的定义------------------ '读写INI文件函数 Option Explicit '写 Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long '读 Public 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 '保存到INI文件 Public Function Wini(ByVal 段 As String, ByVal 键 As String, ByVal 值 As String, IniFile As String) As Boolean Dim X As Long, buff As String * 128, i As Long buff = 值 & Chr(0) X = WritePrivateProfileString(段, 键, buff, IniFile) Wini = X End Function '从INI文件中读取 Public Function Rini(ByVal 段 As String, ByVal 键 As String, IniFile As String) As String Dim X As Long, buff As String * 128, i As Long X = GetPrivateProfileString(段, 键, "", buff, 128, IniFile) i = InStr(buff, Chr(0)) Rini = Trim(Left(buff, i - 1)) End Function
'-------------使用-------------------- for i=0 to list1.listcount-1 '先连接起来 s= s & "|" & list1.list(i) next i saveinit "X","aaa",s,IniFileName '保存