使用open打开你的ini文件
用write写
查看帮助有
用write写
查看帮助有
解决方案 »
- 如何导入导出ACCESS的长二进制文件呢?
- 一堆相同的MaskedTextBox控件,怎么根据控件名或Tag值对其赋值
- 数据读取问题?
- word文档中的控件,不能创建,不能退出设计模式,是什么原因呀!
- 能否打印完后,不用换页
- 关于树型控件的错误。我在做类似资源管理器是的问题
- [在线等待]紧急:wininet.dll问题
- msflecgrid在没有装VB的机子上为什么不能用?我用setup factory打包的
- 老妖是高手
- 请教DDE访问excel电子表格的问题
- 关于微软知识库(VB)文章目录(New 2001/05/30)? (内详)(版主吐血推荐)
- 为什么我的KODARK扫出来的bmp在以资源管理器中以WEB方式浏览是全黑的啊!!!!!!!!!!!!!!!
while eof(1)
line input #1,变量
wend
close #1
while eof(1)
line input #1,bianliang
wend
close #1
Private Declare Function WritePrivateProfileSection Lib "kernel32" Alias "WritePrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpString As String, ByVal lpFileName As String) As Long
Private 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
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
Public Property Get KeyValueOfIni(ByVal strIniFile As String, ByVal strSec As String, _
ByVal strKey As String, ByVal strDef As String) As String
Dim lSize As Long
Dim sResult As String
Dim lLeft As Long
sResult = String(LONGSTR, vbNullChar)
lSize = GetPrivateProfileString(strSec, strKey, strDef, sResult, LONGSTR, strIniFile)
lLeft = InStr(sResult, vbNullChar) - 1
If lLeft > 0 Then
lSize = lLeft
End If
If lSize <> 0 Then
KeyValueOfIni = Left(sResult, lSize)
Else
KeyValueOfIni = ""
End If
sResult = ""
End Property
Public Property Let KeyValueOfIni(ByVal strIniFile As String, ByVal strSec As String, _
ByVal strKey As String, ByVal strDef As String, ByVal Value As String)
If strDef <> Value Then
Call WritePrivateProfileString(strSec, strKey, Value, strIniFile)
End If
End PropertyPublic Property Get SectionKeysValues(ByVal strIniFile As String, ByVal strSec As String)
Dim lSize As Long
Dim sResult As String
Dim a() As String, a1() As String
Dim I As Integer, J As Integer, K As Integer
sResult = String(LONGSTR * 4, 0)
lSize = GetPrivateProfileSection(strSec, sResult, LONGSTR * 4, strIniFile)
If lSize <> 0 Then
sResult = Left(sResult, lSize - 1)
For I = Len(sResult) To 1 Step -1
If Mid(sResult, I, 1) <> vbNullChar Then
Exit For
End If
Next I
sResult = Left(sResult, I)
a = Split(sResult, vbNullChar)
I = UBound(a)
ReDim a1(I, 1)
For I = 0 To I
J = InStr(a(I), "=")
K = Len(a(I))
a1(I, 0) = Left(a(I), J - 1)
a1(I, 1) = Right(a(I), K - J)
Next I
SectionKeysValues = a1
Erase a, a1
End If
End Property
Public Property Let SectionKeysValues(ByVal strIniFile As String, ByVal strSec As String, ArraySettings)
Dim strT As String, I As Integer
strT = ""
For I = 0 To UBound(ArraySettings)
strT = strT & ArraySettings(I, 0) & "=" & ArraySettings(I, 1) & vbNullChar
Next I
strT = strT & vbNullChar
Call WritePrivateProfileSection(strSec, strT, strIniFile)
strT = ""
End Property
Public Sub ReadIniFile() On Error Resume Next Dim strSQL, strLine As String
Dim tmpS() As String
Dim FileNumber As Integer
If Dir(App.Path & "\setuplist.ini") = "" Then
gSQLServer = ""
gDataBase = ""
gLogin = ""
gPassword = ""
Exit Sub
End If
FileNumber = FreeFile
Open App.Path & "\setuplist.Ini" For Input As #FileNumber
Do While Not EOF(FileNumber)
Line Input #FileNumber, strLine
tmpS = Split(strLine, "=")
Select Case UCase(Trim(tmpS(0)))
Case "SQL SERVER"
gSQLServer = Trim(tmpS(1))
Case "DATABASE"
gDataBase = Trim(tmpS(1))
Case "LOGIN"
gLogin = Trim(tmpS(1))
Case "PASSWORD"
gPassword = Trim(tmpS(1))
End Select
Loop
Close #FileNumber
End Sub