关于读写INI文件的问题!
时间:2011-12-21
来源:互联网
这个代码在读写ini文件时有字数限制.
怎么把它改成无限制的???
先上一段读写INI文件的代码.
VB code
这个代码在读写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 Long Private 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 String Private iniSec As String Private iniKey As String '------------------------------------- Public Property Let FileName(strfile As String) If Right(strfile, 4) <> ".ini" Then strfile = strfile & ".ini" End If iniFile = strfile End Property Public Property Get FileName() As String FileName = iniFile End Property Public Property Let Section(strSection As String) iniSec = strSection End Property Public Property Get Section() As String Section = iniSec End Property Public Property Let Key(strKey As String) iniKey = strKey End Property Public Property Get Key() As String Key = iniKey End 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文件时有字数限制.
怎么把它改成无限制的???
作者: hack_bxc 发布时间: 2011-12-21
Dim sTemp As String * 512
Dim nLen As Integer
sTemp = Space$(512)
.
.
nLen = GetPrivateProfileString(iniSec, iniKey, vbNullString, sTemp, 512, iniFile)
---
Dim x As Long, Buff As String * 512, i As Integer
Dim nLen As Integer
sTemp = Space$(512)
.
.
nLen = GetPrivateProfileString(iniSec, iniKey, vbNullString, sTemp, 512, iniFile)
---
Dim x As Long, Buff As String * 512, i As Integer
作者: chinaboyzyq 发布时间: 2011-12-21
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28