高手指教 用VB怎么编写Text1 读取/保存 CS.ini文件

dj888444 2010-06-16 07:07:38
高手指教 用VB怎么编写在程序中 Text1 读取 和 保存程序目录。
...全文
44 点赞 收藏 2
写回复
2 条回复
百事洞明 2010年06月16日
Option Explicit

Public sIniFileDir As String 'ini文件的路径
Public sNeirong() As String

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

Public Function FlGetUserINI()
Dim lpOut As String * 128
Dim Ret As Long
Dim i As Integer
Dim sUser As String
Dim sKey As String

sIniFileDir = Trim(App.Path)
If Right(sIniFileDir, 1) <> "\" Then sIniFileDir = sIniFileDir & "\"
sIniFileDir = sIniFileDir & "HAS_SIM.INI"

For i = 0 To 1000
sKey = "KEY" & i + 1
Ret = GetPrivateProfileString("keshi", sKey, "", lpOut, 128, sIniFileDir)
sUser = FlLeftB(lpOut, Ret)
If sUser = "" Then
Exit Function
End If
ReDim Preserve sNeirong(i)
sNeirong(i) = sUser
Next

End Function

Public Function FlLeftB(p1 As String, p2 As Long) As String
FlLeftB = StrConv(LeftB(StrConv(p1, vbFromUnicode), p2), vbUnicode)
End Function
回复 点赞
百事洞明 2010年06月16日
建议下载配制文件INI操作方法

很简单的
回复 点赞
发动态
发帖子
网络编程
创建于2007-09-28

1145

社区成员

1.8w+

社区内容

VB 网络编程
社区公告
暂无公告