office交流網--QQ交流群號

Access培訓群:792054000         Excel免費交流群群:686050929          Outlook交流群:221378704    

Word交流群:218156588             PPT交流群:324131555

Access數據庫軟件版本號保存在INI文件中,然後從INI文件中提取版本號

2017-09-07 09:05:00
zstmtony
原創
3441


很久以前幫客戶做的一箇客戶管理繫統,有一箇取軟件版本號的函數,感覺還有點用,與大傢分享一下

Access數據庫軟件版本號保存在INI文件中,然後從INI文件中提取軟件的當前版本號(可用來與服務器的最新版本號對比,然後提示是否需要更新)


'軟件版本號保存在INI文件中,然後從INI文件中提取版本號
Private Sub GetCurrVer()
 '作者:tmtony  2003-02-03
 Dim sLine As String, iPos As Integer, sTmp As String
  Dim sFormName As String, sTmp2 As String
  Dim bFormFound As Boolean
  Dim intType As Integer
  Dim iPos2 As Integer
  Dim iSubIndex As Integer
  Dim iIndex As Integer
  Dim sFile As String
  
  sFile = CurrentProject.Path & "\cn2005.ini"

  Open sFile For Input As #1
    Do

      Input #1, sLine

      If Left$(sLine, 1) = ";" Or sLine = "" Then GoTo Jump


      iPos = InStr(sLine, "=")
      
      'sTmp = Mid$(sLine, iPos + 1, InStr(sLine, "=") - iPos - 1)
 

      If iPos > 0 Then
        sTmp = Left$(sLine, iPos - 1)
       'If sTmp = "Version" Then
        sTmp2 = Mid$(sLine, InStr(sLine, "=") + 2)
       'End If
       If Right$(sTmp2, 1) = Chr$(34) Then sTmp2 = Left$(sTmp2, Len(sTmp2) - 1)
       Select Case sTmp
        Case "Version"
            txtCurrVersion = sTmp2
        Case "VersionDate"
            txtCurrVersionDate = sTmp2
        Case "Path"
            Me.txtCurrPath = sTmp2
            
       End Select
       
       GoTo Jump
      End If
      
Jump:


    Loop Until EOF(1)
 
  Close #1
  txtCurrPath = Nz(CurrentProject.Path)
End Sub
分享