提示
compile err:
can't assign array
将ini API中的lpbuffer参数换成temp 就解决了
为何???
Public Function funcThisProgramProfileRead(ByVal lpSectionName As String) As String()
On Error GoTo PROC_ERR
Dim PCount As Integer
Dim lpProfileName As String
Dim sys(1) As String * 255
Dim pro() As String
Dim maxcount As Variant
lpProfileName = App.Path & "\program.ini"
PCount = GetPrivateProfileInt(lpSectionName, "PropertiesCount", 26, lpProfileName)
ReDim pro(PCount)
If lpSectionName = "system" Then
maxcount = GetPrivateProfileInt(lpSectionName, "bMaxCount", 500, lpProfileName)
sys(0) = maxcount
GetPrivateProfileString lpSectionName, "iniFileName", "config.ini", sys(1) , 10, lpProfileName
' sys(1) = temp
funcThisProgramProfileRead = sys()
ElseIf lpSectionName = "properties" Then
For i = LBound(pro) To UBound(pro)
GetPrivateProfileString lpSectionName, CStr(i), "", pro(i) , 100, lpProfileName
' pro(i) = temp
Next
funcThisProgramProfileRead = pro()
End If
Exit Function
PROC_ERR:
MsgBox "Error: " & Err.Number & vbCrLf & Err.Description, , "错误"
On Error GoTo 0
Resume NextEnd Function
compile err:
can't assign array
将ini API中的lpbuffer参数换成temp 就解决了
为何???
Public Function funcThisProgramProfileRead(ByVal lpSectionName As String) As String()
On Error GoTo PROC_ERR
Dim PCount As Integer
Dim lpProfileName As String
Dim sys(1) As String * 255
Dim pro() As String
Dim maxcount As Variant
lpProfileName = App.Path & "\program.ini"
PCount = GetPrivateProfileInt(lpSectionName, "PropertiesCount", 26, lpProfileName)
ReDim pro(PCount)
If lpSectionName = "system" Then
maxcount = GetPrivateProfileInt(lpSectionName, "bMaxCount", 500, lpProfileName)
sys(0) = maxcount
GetPrivateProfileString lpSectionName, "iniFileName", "config.ini", sys(1) , 10, lpProfileName
' sys(1) = temp
funcThisProgramProfileRead = sys()
ElseIf lpSectionName = "properties" Then
For i = LBound(pro) To UBound(pro)
GetPrivateProfileString lpSectionName, CStr(i), "", pro(i) , 100, lpProfileName
' pro(i) = temp
Next
funcThisProgramProfileRead = pro()
End If
Exit Function
PROC_ERR:
MsgBox "Error: " & Err.Number & vbCrLf & Err.Description, , "错误"
On Error GoTo 0
Resume NextEnd Function
解决方案 »
- Inet发送问题
- setupFactory6.0制作的安装文件,开始安装时会闪一次setupFactory的标志,如何去掉
- 关于对数字字符个数量
- 这个VB如何得到物理硬盘序列号的??????
- 用api开关光驱门的时候若碰到有多个光驱怎么办
- 有谁知道,Dll_DbAcc.dll 在哪里可得到?谢谢了,在线等待。。
- 难的问题解决送分
- 删除图片框中的线!答对者重重加分(100)
- VB中怎样打印曲线
- 急!!升级到Excel2016后,VBA代码不见了!而且不能进入设计模式!
- error C2065: 'adCmdText' : undeclared identifier怎么回事?
- 焦点问题,敬请关注!
这样返回什么都可以(包括数组)