主题:[原创]GetPrivateProfileSection
Function ReadIniSection(ByRef MainKey As String, ByRef IniPath As String) As String
Dim TemStr As String
Dim ResultStr As String = ""
Try
Dim INI文件 As New System.IO.FileInfo(IniPath)
If Not INI文件.Exists Then
MsgBox("你所指定的INI文件不存在!", 0 + 16, "错误")
Return "NULL"
End If
Call GetPrivateProfileSection(MainKey, ResultStr, 500, IniPath)
TemStr = ResultStr
Return ResultStr
Catch ex As Exception
MsgBox("错误:" & Err.Number & vbCrLf & Err.Description, 0 + "读 取INI文件错误")
Return "NULL"
End Try
End Function
运行会出错,提示信息如下:
错误:-214767261
尝试读取或写入受保护的内存.这通常指示其他内存已损坏.
怎样解决
Dim TemStr As String
Dim ResultStr As String = ""
Try
Dim INI文件 As New System.IO.FileInfo(IniPath)
If Not INI文件.Exists Then
MsgBox("你所指定的INI文件不存在!", 0 + 16, "错误")
Return "NULL"
End If
Call GetPrivateProfileSection(MainKey, ResultStr, 500, IniPath)
TemStr = ResultStr
Return ResultStr
Catch ex As Exception
MsgBox("错误:" & Err.Number & vbCrLf & Err.Description, 0 + "读 取INI文件错误")
Return "NULL"
End Try
End Function
运行会出错,提示信息如下:
错误:-214767261
尝试读取或写入受保护的内存.这通常指示其他内存已损坏.
怎样解决