最好用api:GetPrivateProfileSection VB声明 Declare Function GetPrivateProfileSection Lib "kernel32" Alias "GetPrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long 说明 获取指定小节所有项名和值的一个列表 返回值 Long,装载到lpReturnedString缓冲区的字符数量。如缓冲区的容量不够大,不能容下所有信息,就返回nSize-2 参数表 参数 类型及说明 lpAppName String,欲获取的小节。注意这个字串不区分大小写 lpReturnedString String,项和值字串的列表。每个字串都由一个NULL字符分隔,最后一个字串后面用两个NULL字符中止 nSize Long,lpReturnedString缓冲区的大小。在windows系统中最大值为32767 lpFileName String,初始化文件的名字。如没有指定完整路径名,windows就在Windows目录中查找文件 注解 参考对GetPrivateProfileInt函数的注解
Public Function PutToINI(ByVal sApp As String, ByVal sKey As String, ByVal sValue As String) As Boolean Dim lReturn As Long Dim sFilename As String
sFilename = App.Path & "\" & gcsINIFileName lReturn = WritePrivateProfileString(sApp, sKey, sValue, sFilename) PutToINI = (lReturn = 1) End FunctionPublic Function GetInINI(ByVal sApp As String, ByVal sKey As String, ByRef sValue As String) As Boolean Dim lReturn As Long Dim sBuffer As String Dim sFilename As String
On Error Resume Next sFilename = App.Path & "\" & gcsINIFileName sBuffer = String(1024, 0) lReturn = GetPrivateProfileString(sApp, sKey, "", sBuffer, 1024, sFilename) sValue = Left(sBuffer, lReturn) GetInINI = (Err.Number = 0) End Function
'------------------------------------------------------------------------------------读取INI、TXT等文本文件的字符串 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 '------------------------------------------------------------------------------------删除INI、TXT等文本文件的字符串和键值 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 Declare Function WritePrivateProfileSection Lib "kernel32" Alias "WritePrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpString As String, ByVal lpFileName As String) As Long '删除字符串的值保留键值(如:、[Server]被保留,它下面的值被删除)Public Function GetIniString(AppName As String, Key As String, FilePath As String) As String '读取INI、TXT等文本文件的字符串 Dim Iret As Long 'return code Dim retStr As String * 1000 'return string -> answer is in it
Iret = GetPrivateProfileString(AppName, Key, "", retStr, 1000, FilePath) retStr = Replace(retStr, Chr(0), "") GetIniString = retStr GetIniString = Trim(GetIniString) End FunctionPublic Sub DeleteIniString(AppName As String, Key As String, FilePath As String) '删除INI、TXT等文件的某个变量值 WritePrivateProfileString AppName, Key, 0&, FilePath End SubPublic Sub DeleteIniKeyLeft(AppName As String, FilePath As String) '删除键值以下的变量值(如:、[Server]被保留,它下面的值被删除) WritePrivateProfileSection AppName, "", FilePath End SubPublic Sub DeleteIniKeyAll(AppName As String, FilePath As String) '删除INI、TXT等文件的键值和属于他的变量值 WritePrivateProfileString AppName, 0&, 0&, FilePath End SubPublic Sub WriteIniFile(AppName As String, Key As String, Value As String, FilePath As String) '写INI文件 WritePrivateProfileString AppName, Key, Value, FilePath End Sub
ini.clsPublic File As StringPrivate 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 Integer, ByVal lpFileName As String) As Integer Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal Appname As String, ByVal KeyName As Any, ByVal NewString As Any, ByVal FileName As String) As IntegerSub DeleteSection(ByVal Section As String) Dim retval As Integer retval = WritePrivateProfileString(Section, 0&, "", File) End SubPublic Function SaveSetting(ByVal Section$, ByVal Key$, ByVal Value$) Dim retval As Integer SaveSetting = WritePrivateProfileString(Section$, Key$, Value$, File) End FunctionPublic Function GetSetting(ByVal Section As String, ByVal KeyName As String) As String Dim retval As Integer Dim t As String * 255
If retval > 0 Then GetSetting = Left$(t, retval) Else GetSetting = "" End If End FunctionPublic Function GetSection(ByVal Section As String, KeyArray() As String) As Integer Dim retval As Integer Dim t As String * 2500 Dim lastpointer As Integer Dim nullpointer As Integer Dim ArrayCount As Integer Dim keystring As String
If retval > 0 Then nullpointer = InStr(t, Chr$(0)) lastpointer = 1 Do While (nullpointer <> 0 And nullpointer > lastpointer + 1) keystring = Mid$(t, lastpointer, nullpointer - lastpointer) ArrayCount = ArrayCount + 1 ReDim Preserve KeyArray(ArrayCount) KeyArray(ArrayCount) = keystring lastpointer = nullpointer + 1 nullpointer = InStr(nullpointer + 1, t, Chr$(0)) Loop End If GetSection = ArrayCount End Function
给你一个例子: Dim IniPath As String Dim IniFile As String Dim strLine As String Dim MYINI As String IniPath = App.path IniFile = Dir(IniPath & "\" & "TEXT.INI") If IniFile <> "" Then MYINI = IniPath & "\" & IniFile Open MYINI For Input As #1 Input #1, strLine
Input #1, strLine gstrServer = Trim(Mid(strLine, 12, Len(strLine))) Input #1, strLine gstrDatabase = Trim(Mid(strLine, 10, Len(strLine))) Input #1, strLine Input #1, strLine Input #1, strLine gHTDataPath = Trim(Mid(strLine, 12, Len(strLine))) Input #1, strLine Input #1, strLine Input #1, strLine Input #1, strLine strLine = Trim(Mid(strLine, 6, Len(strLine))) If UCase(strLine) = "COM1" Then gComPort = 0 Else gComPort = 1 End If Close #1 Else MsgBox "Can not Open INI File" End If
'------------------------------------------------------------------------------------读取INI、TXT等文本文件的字符串 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 '------------------------------------------------------------------------------------删除INI、TXT等文本文件的字符串和键值 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 Declare Function WritePrivateProfileSection Lib "kernel32" Alias "WritePrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpString As String, ByVal lpFileName As String) As Long '删除字符串的值保留键值(如:、[Server]被保留,它下面的值被删除)Public Function GetIniString(AppName As String, Key As String, FilePath As String) As String '读取INI、TXT等文本文件的字符串 Dim Iret As Long 'return code Dim retStr As String * 1000 'return string -> answer is in it
Iret = GetPrivateProfileString(AppName, Key, "", retStr, 1000, FilePath) retStr = Replace(retStr, Chr(0), "") GetIniString = retStr GetIniString = Trim(GetIniString) End FunctionPublic Sub DeleteIniString(AppName As String, Key As String, FilePath As String) '删除INI、TXT等文件的某个变量值 WritePrivateProfileString AppName, Key, 0&, FilePath End SubPublic Sub DeleteIniKeyLeft(AppName As String, FilePath As String) '删除键值以下的变量值(如:、[Server]被保留,它下面的值被删除) WritePrivateProfileSection AppName, "", FilePath End SubPublic Sub DeleteIniKeyAll(AppName As String, FilePath As String) '删除INI、TXT等文件的键值和属于他的变量值 WritePrivateProfileString AppName, 0&, 0&, FilePath End SubPublic Sub WriteIniFile(AppName As String, Key As String, Value As String, FilePath As String) '写INI文件 WritePrivateProfileString AppName, Key, Value, FilePath End Sub
Function mfncGetFromIni (strSectionHeader As String, strVariableName As String, strFileName As String) As String '*** DESCRIPTION:Reads from an *.INI fil ' e strFileName (full path & file name) '*** RETURNS:The string stored in [strSe ' ctionHeader], line beginning strVariableName= '*** NOTE: Requires declaration of API c ' all GetPrivateProfileString 'Initialise variable Dim strReturn As String 'Blank the return string strReturn = String(255, Chr(0)) 'Get requested information, trimming the ' returned string mfncGetFromIni = Left$(strReturn, GetPrivateProfileString(strSectionHeader, ByVal strVariableName, "", strReturn, Len(strReturn), strFileName)) End Function Function mfncParseString (strIn As String, intOffset As Integer, strDelimiter As String) As String '*** DESCRIPTION:Parses the passed strin ' g, returning the value indicated '***by the offset specified, eg: the str ' ing "Hello, World", '***offset 2 = "World". '*** RETURNS:See description. '*** NOTE: The offset starts at 1 and th ' e delimiter is the character '***which separates the elements of the ' string. 'Trap any bad calls If Len(strIn) = 0 Or intOffset = 0 Then mfncParseString = "" Exit Function End If 'Declare local variables Dim intStartPos As Integer ReDim intDelimPos(10) As Integer Dim intStrLen As Integer Dim intNoOfDelims As Integer Dim intCount As Integer Dim strQuotationMarks As String Dim intInsideQuotationMarks As Integer strQuotationMarks = Chr(34) & Chr(147) & Chr(148) intInsideQuotationMarks = False For intCount = 1 To Len(strIn) 'If character is a double-quote then tog ' gle the In Quotation flag If InStr(strQuotationMarks, Mid$(strIn, intCount, 1)) <> 0 Then intInsideQuotationMarks = (Not intInsideQuotationMarks) End If If (Not intInsideQuotationMarks) And (Mid$(strIn, intCount, 1) = strDelimiter) Then intNoOfDelims = intNoOfDelims + 1 'If array filled then enlarge it, keepin ' g existing contents If (intNoOfDelims Mod 10) = 0 Then ReDim Preserve intDelimPos(intNoOfDelims + 10) End If intDelimPos(intNoOfDelims) = intCount End If Next intCount 'Handle request for value not present (o ' ver-run) If intOffset > (intNoOfDelims + 1) Then mfncParseString = "" Exit Function End If 'Handle boundaries of string If intOffset = 1 Then intStartPos = 1 End If 'Requesting last value - handle null If intOffset = (intNoOfDelims + 1) Then If Right$(strIn, 1) = strDelimiter Then intStartPos = -1 intStrLen = -1 mfncParseString = "" Exit Function Else intStrLen = Len(strIn) - intDelimPos(intOffset - 1) End If End If 'Set start and length variables if not h ' andled by boundary check above If intStartPos = 0 Then intStartPos = intDelimPos(intOffset - 1) + 1 End If If intStrLen = 0 Then intStrLen = intDelimPos(intOffset) - intStartPos End If 'Set the return string mfncParseString = Mid$(strIn, intStartPos, intStrLen) End Function Function mfncWriteIni (strSectionHeader As String, strVariableName As String, strValue As String, strFileName As String) As Integer '*** DESCRIPTION:Writes to an *.INI file ' called strFileName (full path & file name) '*** RETURNS:Integer indicating failure ' (0) or success (other) To write '*** NOTE: Requires declaration of API c ' all WritePrivateProfileString 'Call the API mfncWriteIni = WritePrivateProfileString(strSectionHeader, strVariableName, strValue, strFileName) End Function
上面的兄弟们都很热情,基本可行 嘿嘿,核心问题已经解决了,我来给你结个尾吧 利用上面iwillgo2的方法, dim str1 as string dim str2 as string str1 = GetIniString("用户信息", "user", App.Path & "\22.ini") str2=GetIniString("用户信息", "password", App.Path & "\22.ini") text1.text=str1 text2.text=str2 哈哈,给分吧
只要回答正确,分我一定给你
Declare Function GetPrivateProfileSection Lib "kernel32" Alias "GetPrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
说明
获取指定小节所有项名和值的一个列表
返回值
Long,装载到lpReturnedString缓冲区的字符数量。如缓冲区的容量不够大,不能容下所有信息,就返回nSize-2
参数表
参数 类型及说明
lpAppName String,欲获取的小节。注意这个字串不区分大小写
lpReturnedString String,项和值字串的列表。每个字串都由一个NULL字符分隔,最后一个字串后面用两个NULL字符中止
nSize Long,lpReturnedString缓冲区的大小。在windows系统中最大值为32767
lpFileName String,初始化文件的名字。如没有指定完整路径名,windows就在Windows目录中查找文件
注解
参考对GetPrivateProfileInt函数的注解
Dim lReturn As Long
Dim sFilename As String
sFilename = App.Path & "\" & gcsINIFileName
lReturn = WritePrivateProfileString(sApp, sKey, sValue, sFilename)
PutToINI = (lReturn = 1)
End FunctionPublic Function GetInINI(ByVal sApp As String, ByVal sKey As String, ByRef sValue As String) As Boolean
Dim lReturn As Long
Dim sBuffer As String
Dim sFilename As String
On Error Resume Next
sFilename = App.Path & "\" & gcsINIFileName
sBuffer = String(1024, 0)
lReturn = GetPrivateProfileString(sApp, sKey, "", sBuffer, 1024, sFilename)
sValue = Left(sBuffer, lReturn)
GetInINI = (Err.Number = 0)
End Function
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
'------------------------------------------------------------------------------------删除INI、TXT等文本文件的字符串和键值
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 Declare Function WritePrivateProfileSection Lib "kernel32" Alias "WritePrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpString As String, ByVal lpFileName As String) As Long '删除字符串的值保留键值(如:、[Server]被保留,它下面的值被删除)Public Function GetIniString(AppName As String, Key As String, FilePath As String) As String '读取INI、TXT等文本文件的字符串
Dim Iret As Long 'return code
Dim retStr As String * 1000 'return string -> answer is in it
Iret = GetPrivateProfileString(AppName, Key, "", retStr, 1000, FilePath)
retStr = Replace(retStr, Chr(0), "")
GetIniString = retStr
GetIniString = Trim(GetIniString)
End FunctionPublic Sub DeleteIniString(AppName As String, Key As String, FilePath As String) '删除INI、TXT等文件的某个变量值
WritePrivateProfileString AppName, Key, 0&, FilePath
End SubPublic Sub DeleteIniKeyLeft(AppName As String, FilePath As String) '删除键值以下的变量值(如:、[Server]被保留,它下面的值被删除)
WritePrivateProfileSection AppName, "", FilePath
End SubPublic Sub DeleteIniKeyAll(AppName As String, FilePath As String) '删除INI、TXT等文件的键值和属于他的变量值
WritePrivateProfileString AppName, 0&, 0&, FilePath
End SubPublic Sub WriteIniFile(AppName As String, Key As String, Value As String, FilePath As String) '写INI文件
WritePrivateProfileString AppName, Key, Value, FilePath
End Sub
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal Appname As String, ByVal KeyName As Any, ByVal NewString As Any, ByVal FileName As String) As IntegerSub DeleteSection(ByVal Section As String)
Dim retval As Integer
retval = WritePrivateProfileString(Section, 0&, "", File)
End SubPublic Function SaveSetting(ByVal Section$, ByVal Key$, ByVal Value$)
Dim retval As Integer
SaveSetting = WritePrivateProfileString(Section$, Key$, Value$, File)
End FunctionPublic Function GetSetting(ByVal Section As String, ByVal KeyName As String) As String
Dim retval As Integer
Dim t As String * 255
retval = GetPrivateProfileString(Section, KeyName, "unknown value", t, Len(t), File)
If retval > 0 Then
GetSetting = Left$(t, retval)
Else
GetSetting = ""
End If
End FunctionPublic Function GetSection(ByVal Section As String, KeyArray() As String) As Integer
Dim retval As Integer
Dim t As String * 2500
Dim lastpointer As Integer
Dim nullpointer As Integer
Dim ArrayCount As Integer
Dim keystring As String
ReDim KeyArray(0)
retval = GetPrivateProfileString(Section, 0&, "", t, Len(t), File)
If retval > 0 Then
nullpointer = InStr(t, Chr$(0))
lastpointer = 1
Do While (nullpointer <> 0 And nullpointer > lastpointer + 1)
keystring = Mid$(t, lastpointer, nullpointer - lastpointer)
ArrayCount = ArrayCount + 1
ReDim Preserve KeyArray(ArrayCount)
KeyArray(ArrayCount) = keystring
lastpointer = nullpointer + 1
nullpointer = InStr(nullpointer + 1, t, Chr$(0))
Loop
End If
GetSection = ArrayCount
End Function
Dim IniPath As String
Dim IniFile As String
Dim strLine As String
Dim MYINI As String
IniPath = App.path
IniFile = Dir(IniPath & "\" & "TEXT.INI")
If IniFile <> "" Then
MYINI = IniPath & "\" & IniFile
Open MYINI For Input As #1
Input #1, strLine
Input #1, strLine
gstrServer = Trim(Mid(strLine, 12, Len(strLine)))
Input #1, strLine
gstrDatabase = Trim(Mid(strLine, 10, Len(strLine)))
Input #1, strLine
Input #1, strLine
Input #1, strLine
gHTDataPath = Trim(Mid(strLine, 12, Len(strLine)))
Input #1, strLine
Input #1, strLine
Input #1, strLine
Input #1, strLine
strLine = Trim(Mid(strLine, 6, Len(strLine)))
If UCase(strLine) = "COM1" Then
gComPort = 0
Else
gComPort = 1
End If
Close #1
Else
MsgBox "Can not Open INI File"
End If
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
'------------------------------------------------------------------------------------删除INI、TXT等文本文件的字符串和键值
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 Declare Function WritePrivateProfileSection Lib "kernel32" Alias "WritePrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpString As String, ByVal lpFileName As String) As Long '删除字符串的值保留键值(如:、[Server]被保留,它下面的值被删除)Public Function GetIniString(AppName As String, Key As String, FilePath As String) As String '读取INI、TXT等文本文件的字符串
Dim Iret As Long 'return code
Dim retStr As String * 1000 'return string -> answer is in it
Iret = GetPrivateProfileString(AppName, Key, "", retStr, 1000, FilePath)
retStr = Replace(retStr, Chr(0), "")
GetIniString = retStr
GetIniString = Trim(GetIniString)
End FunctionPublic Sub DeleteIniString(AppName As String, Key As String, FilePath As String) '删除INI、TXT等文件的某个变量值
WritePrivateProfileString AppName, Key, 0&, FilePath
End SubPublic Sub DeleteIniKeyLeft(AppName As String, FilePath As String) '删除键值以下的变量值(如:、[Server]被保留,它下面的值被删除)
WritePrivateProfileSection AppName, "", FilePath
End SubPublic Sub DeleteIniKeyAll(AppName As String, FilePath As String) '删除INI、TXT等文件的键值和属于他的变量值
WritePrivateProfileString AppName, 0&, 0&, FilePath
End SubPublic Sub WriteIniFile(AppName As String, Key As String, Value As String, FilePath As String) '写INI文件
WritePrivateProfileString AppName, Key, Value, FilePath
End Sub
String, strFileName As String) As String
'*** DESCRIPTION:Reads from an *.INI fil
' e strFileName (full path &
file name)
'*** RETURNS:The string stored in [strSe
' ctionHeader], line
beginning strVariableName=
'*** NOTE: Requires declaration of API c
' all
GetPrivateProfileString
'Initialise variable
Dim strReturn As String
'Blank the return string
strReturn = String(255, Chr(0))
'Get requested information, trimming the
' returned string
mfncGetFromIni = Left$(strReturn,
GetPrivateProfileString(strSectionHeader, ByVal strVariableName, "",
strReturn, Len(strReturn), strFileName))
End Function
Function mfncParseString (strIn As String, intOffset As Integer,
strDelimiter As String) As String
'*** DESCRIPTION:Parses the passed strin
' g, returning the value
indicated
'***by the offset specified, eg: the str
' ing "Hello,
World",
'***offset 2 = "World".
'*** RETURNS:See description.
'*** NOTE: The offset starts at 1 and th
' e delimiter is the
character
'***which separates the elements of the
' string.
'Trap any bad calls
If Len(strIn) = 0 Or intOffset = 0 Then
mfncParseString = ""
Exit Function
End If
'Declare local variables
Dim intStartPos As Integer
ReDim intDelimPos(10) As Integer
Dim intStrLen As Integer
Dim intNoOfDelims As Integer
Dim intCount As Integer
Dim strQuotationMarks As String
Dim intInsideQuotationMarks As Integer
strQuotationMarks = Chr(34) & Chr(147) & Chr(148)
intInsideQuotationMarks = False
For intCount = 1 To Len(strIn)
'If character is a double-quote then tog
' gle the In Quotation flag
If InStr(strQuotationMarks, Mid$(strIn, intCount, 1)) <> 0 Then
intInsideQuotationMarks = (Not intInsideQuotationMarks)
End If
If (Not intInsideQuotationMarks) And (Mid$(strIn, intCount, 1) =
strDelimiter) Then
intNoOfDelims = intNoOfDelims + 1
'If array filled then enlarge it, keepin
' g existing contents
If (intNoOfDelims Mod 10) = 0 Then
ReDim Preserve intDelimPos(intNoOfDelims + 10)
End If
intDelimPos(intNoOfDelims) = intCount
End If
Next intCount
'Handle request for value not present (o
' ver-run)
If intOffset > (intNoOfDelims + 1) Then
mfncParseString = ""
Exit Function
End If
'Handle boundaries of string
If intOffset = 1 Then
intStartPos = 1
End If
'Requesting last value - handle null
If intOffset = (intNoOfDelims + 1) Then
If Right$(strIn, 1) = strDelimiter Then
intStartPos = -1
intStrLen = -1
mfncParseString = ""
Exit Function
Else
intStrLen = Len(strIn) - intDelimPos(intOffset - 1)
End If
End If
'Set start and length variables if not h
' andled by boundary check above
If intStartPos = 0 Then
intStartPos = intDelimPos(intOffset - 1) + 1
End If
If intStrLen = 0 Then
intStrLen = intDelimPos(intOffset) - intStartPos
End If
'Set the return string
mfncParseString = Mid$(strIn, intStartPos, intStrLen)
End Function
Function mfncWriteIni (strSectionHeader As String, strVariableName As
String, strValue As String, strFileName As String) As Integer
'*** DESCRIPTION:Writes to an *.INI file
' called strFileName (full
path & file name)
'*** RETURNS:Integer indicating failure
' (0) or success (other)
To write
'*** NOTE: Requires declaration of API c
' all
WritePrivateProfileString
'Call the API
mfncWriteIni = WritePrivateProfileString(strSectionHeader,
strVariableName, strValue, strFileName)
End Function
嘿嘿,核心问题已经解决了,我来给你结个尾吧
利用上面iwillgo2的方法,
dim str1 as string
dim str2 as string
str1 = GetIniString("用户信息", "user", App.Path & "\22.ini")
str2=GetIniString("用户信息", "password", App.Path & "\22.ini")
text1.text=str1
text2.text=str2
哈哈,给分吧