首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

关于读写INI文件的有关问题

2012-04-05 
关于读写INI文件的问题!这个代码在读写ini文件时有字数限制.怎么把它改成无限制的???先上一段读写INI文件

关于读写INI文件的问题!
这个代码在读写ini文件时有字数限制.
怎么把它改成无限制的???
先上一段读写INI文件的代码.

VB code
'声明API函数Private 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 LongPrivate 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'-------------------------------------------------'声明变量Private iniFile As StringPrivate iniSec As StringPrivate iniKey As String'-------------------------------------Public Property Let FileName(strfile As String)     If Right(strfile, 4) <> ".ini" Then         strfile = strfile & ".ini"     End If     iniFile = strfileEnd PropertyPublic Property Get FileName() As String    FileName = iniFileEnd PropertyPublic Property Let Section(strSection As String)    iniSec = strSectionEnd PropertyPublic Property Get Section() As String    Section = iniSecEnd PropertyPublic Property Let Key(strKey As String)    iniKey = strKeyEnd PropertyPublic Property Get Key() As String    Key = iniKeyEnd Property'读取INI文件中的条目Public Function ReadItem(Optional ByVal strSection As String, Optional ByVal strKey As String)    Dim sTemp As String * 256    Dim nLen As Integer    sTemp = Space$(256)    '如果没有指定参数则按属性设置进行    If Len(strSection) > 0 Then       iniSec = strSection    End If    If Len(strKey) > 0 Then       iniKey = strKey    End If    nLen = GetPrivateProfileString(iniSec, iniKey, vbNullString, sTemp, 255, iniFile)    ReadItem = Left$(sTemp, nLen)End Function'将指定信息写入INI文件Public Function WriteItem(ByVal value As String, Optional ByVal strSection As String, Optional ByVal strKey As String)        Dim x As Long, Buff As String * 256, i As Integer        'INI文件中的字符串必须以字符CHr(0)结尾    Buff = value + Chr(0)    If Len(strSection) > 0 Then       iniSec = strSection    End If    If Len(strKey) > 0 Then       iniKey = strKey    End If    x = WritePrivateProfileString(iniSec, iniKey, Buff, iniFile)    If x = 0 Then MsgBox "ini文件写入错误!", , ""    End Function

这个代码在读写ini文件时有字数限制.
怎么把它改成无限制的???

[解决办法]
http://download.csdn.net/detail/veron_04/3057337

热点排行