用GetPrivateProfileSection读取一个section下的所有的数据
然后再自己拆分 ( split(strRet,vbnullchar) )
然后再自己拆分 ( split(strRet,vbnullchar) )
Public Function LoadCompareData() As Boolean Dim FileName As String, TempString As String, Temp As String, BuffTemp() As String Dim FileNum As Integer, count As Integer, i As Integer Dim UISETFlag As Boolean, CompareDataFlag As Boolean, ROMAXFlag As Boolean, LegendListFlag As Boolean FileNum = FreeFile: FileName = App.Path & "\" & "123.ini": count = 0: TempString = "" UISETFlag = False: CompareDataFlag = False: ROMAXFlag = False: LegendListFlag = False Open FileName For Input As #FileNum Do While Not EOF(FileNum) Line Input #FileNum, TempString If TempString <> "" Then If InStr(TempString, "<") <> 0 And InStr(TempString, ">") <> 0 Then Temp = Mid(TempString, InStr(TempString, "<") + 1, InStr(TempString, ">") - InStr(TempString, "<") - 1) Select Case Temp Case "UISET" UISETFlag = True: CompareDataFlag = False: ROMAXFlag = False: LegendListFlag = False count = 0 Case "CompareData" UISETFlag = False: CompareDataFlag = True: ROMAXFlag = False: LegendListFlag = False count = 0 Case "ROMAX" UISETFlag = False: CompareDataFlag = False: ROMAXFlag = True: LegendListFlag = False count = 0 Case "LegendList" UISETFlag = False: CompareDataFlag = False: ROMAXFlag = False: LegendListFlag = True count = 0 End Select End If If UISETFlag = True Then If AutoMode = True Then If InStr(TempString, "MaxBin") <> 0 Then If Len(TempString) > InStr(TempString, "=") Then frmMain.txtMaxBin.Text = Mid(TempString, InStr(TempString, "=") + 1, Len(TempString) - InStr(TempString, "=")) End If ElseIf InStr(TempString, "PassBin") <> 0 Then If Len(TempString) > InStr(TempString, "=") Then frmMain.SetPass.Text = Mid(TempString, InStr(TempString, "=") + 1, Len(TempString) - InStr(TempString, "=")) End If ElseIf InStr(TempString, "Target") <> 0 Then If Len(TempString) > InStr(TempString, "=") Then frmMain.txtTargetPath.Text = Mid(TempString, InStr(TempString, "=") + 1, Len(TempString) - InStr(TempString, "=")) End If End If End If If InStr(TempString, "OperatingMode") <> 0 Then If Len(TempString) > InStr(TempString, "=") Then If Mid(TempString, InStr(TempString, "=") + 1, Len(TempString) - InStr(TempString, "=")) = 0 Then AutoMode = False Else AutoMode = True End If End If ElseIf InStr(TempString, "UsePath") <> 0 Then If Len(TempString) > InStr(TempString, "=") Then If Mid(TempString, InStr(TempString, "=") + 1, Len(TempString) - InStr(TempString, "=")) = 0 Then UsePath = False Else UsePath = True End If End If End If ElseIf CompareDataFlag = True Then If InStr(TempString, "=") <> 0 And Len(TempString) > InStr(TempString, "=") Then BuffTemp = Split(TempString, "=") ReDim Preserve Path1(count): ReDim Preserve Path2(count) Path1(count) = BuffTemp(0): Path2(count) = BuffTemp(1) count = count + 1 Erase BuffTemp End If ElseIf ROMAXFlag = True Then If InStr(TempString, ",") <> 0 And Len(TempString) > InStr(TempString, ",") Then If Trim(TempString) <> "" Then BuffTemp = Split(TempString, ",") For i = 0 To 2 ROMAX(i, count) = BuffTemp(i) Next i count = count + 1 End If Erase BuffTemp End If ElseIf LegendListFlag = True Then If InStr(TempString, "[") <> 0 And InStr(TempString, "]") <> 0 And InStr(TempString, "__") <> 0 Then If Trim(TempString) <> "" Then ReDim Preserve LegendList(count) LegendList(count) = TempString count = count + 1 End If End If End If End If Loop Close #FileNum End Function
Public Function SelectCheckItem(ItemName As String) As Boolean Dim FileName As String, TempString As String, Temp As String Dim FileN As Integer, i As Integer Dim SetAll As Boolean, JoinDomain As Boolean, SetOffice2003 As Boolean FileName = Trim(App.Path): FileN = FreeFile i = 0: ReDim Project.ProjectList(0) If Right(FileName, 1) = "\" Then FileName = FileName & "ProgressNow.ini" Else FileName = FileName & "\ProgressNow.ini" End If Open FileName For Input As #FileN Do While Not EOF(FileN) Line Input #FileN, TempString TempString = Trim(TempString) If InStr(TempString, "[") <> 0 And InStr(TempString, "]") <> 0 Then Temp = Mid(TempString, InStr(TempString, "[") + 1, InStr(TempString, "]") - InStr(TempString, "[") - 1) Select Case Temp Case "SetAll" SetAll = True: JoinDomain = False: SetOffice2003 = False Case "JoinDomain" SetAll = False: JoinDomain = True: SetOffice2003 = False Case "SetOffice2003" SetAll = False: JoinDomain = False: SetOffice2003 = True End Select End If If SetAll = True And ItemName = "SetAll" Then If InStr(TempString, "=") <> 0 Then If Len(TempString) > InStr(TempString, "=") Then ReDim Preserve Project.ProjectList(i) Project.ProjectList(i) = Trim(Mid(TempString, 1, InStr(TempString, "=") - 1)) & "," & _ Trim(Mid(TempString, InStr(TempString, "=") + 1, Len(TempString) - InStr(TempString, "="))) i = i + 1 End If Else ReDim Preserve Project.ProjectList(i) Project.ProjectList(i) = "" i = i + 1 End If ElseIf JoinDomain = True And ItemName = "JoinDomain" Then If InStr(TempString, "=") <> 0 Then If Len(TempString) > InStr(TempString, "=") Then ReDim Preserve Project.ProjectList(i) Project.ProjectList(i) = Trim(Mid(TempString, 1, InStr(TempString, "=") - 1)) & "," & _ Trim(Mid(TempString, InStr(TempString, "=") + 1, Len(TempString) - InStr(TempString, "="))) i = i + 1 End If Else ReDim Preserve Project.ProjectList(i) Project.ProjectList(i) = "" i = i + 1 End If ElseIf SetOffice2003 = True And ItemName = "SetOffice2003" Then If InStr(TempString, "=") <> 0 Then If Len(TempString) > InStr(TempString, "=") Then ReDim Preserve Project.ProjectList(i) Project.ProjectList(i) = Trim(Mid(TempString, 1, InStr(TempString, "=") - 1)) & "," & _ Trim(Mid(TempString, InStr(TempString, "=") + 1, Len(TempString) - InStr(TempString, "="))) i = i + 1 End If Else ReDim Preserve Project.ProjectList(i) Project.ProjectList(i) = "" i = i + 1 End If End If Loop Close #FileN End Function