CheckVersion




Option Explicit
Type VersionNumber
Major As Variant
Minor As Variant
Revision As Variant
UpdateFileURL As Variant
End Type
Type VersionNumber2
Major As Integer
Minor As Integer
Revision As Integer
UpdateFileURL As Variant
End Type
Public Sub NewVersionCheck()
On Error Goto UpdateProblem
If Winsock1.LocalIP <> "127.0.0.1" Then
Dim NewVersion As VersionNumber
Dim NewVersion2 As VersionNumber2
Dim intFile As Long
intFile = FreeFile
Open App.Path & "\updatechk.txt" For Output As #intFile
Print #intFile, Inet1.OpenURL("http://www.yoursite.com/folder/updatefile.txt")
Close #intFile
intFile = FreeFile
Open App.Path & "\updatechk.txt" For Input As #intFile
Input #intFile, NewVersion.Major, NewVersion.Minor, _
NewVersion.Revision, NewVersion.UpdateFileURL
Close #intFile
NewVersion2.Major = CInt(NewVersion.Major)
NewVersion2.Minor = CInt(NewVersion.Minor)
NewVersion2.Revision = CInt(NewVersion.Revision)
NewVersion2.UpdateFileURL = NewVersion.UpdateFileURL
If NewVersion2.Major > App.Major Or NewVersion2.Minor _
> App.Minor Or NewVersion2.Revision > App.Revision Then
If MsgBox("E' disponibile una nuova versione del programma!" & _
vbNewLine & "Vuoi prelevare l'aggiornamento?", _
vbYesNo, "Update available!") = vbYes Then
Kill App.Path & "\updatechk.txt"
Shell "rundll32.exe url.dll,FileProtocolHandler " & NewVersion2.UpdateFileURL,3
End
Else: Kill App.Path & "\updatechk.txt"
End If
Else: Kill App.Path & "\updatechk.txt"
End If
End If

Exit Sub

UpdateProblem:
MsgBox "Errore durante il tentativo dell'aggiornamento." & _
vbNewLine & "Contattare l'assistenza per il supporto", _
vbCritical, "Error in Update Check!"
Exit Sub
End Sub

Per questo progetto dovete avere il controllo
Microsoft Internet Transfer Control nel vostro
progetto










( checkversion.html )- by Paolo Puglisi - Modifica del 17/12/2023