home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD78117152000.psc / Update-Program / Auto Update / frmUpdate.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2000-07-15  |  8.8 KB  |  271 lines

  1. VERSION 5.00
  2. Object = "{48E59290-9880-11CF-9754-00AA00C00908}#1.0#0"; "MSINET.OCX"
  3. Begin VB.Form frmUpdate 
  4.    Caption         =   "Auto Update Deluxe"
  5.    ClientHeight    =   4575
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   6660
  9.    Icon            =   "frmUpdate.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    Moveable        =   0   'False
  12.    ScaleHeight     =   5537.202
  13.    ScaleMode       =   0  'User
  14.    ScaleWidth      =   6660
  15.    StartUpPosition =   2  'CenterScreen
  16.    Begin InetCtlsObjects.Inet InetUpdate 
  17.       Left            =   1560
  18.       Top             =   1920
  19.       _ExtentX        =   1005
  20.       _ExtentY        =   1005
  21.       _Version        =   393216
  22.    End
  23.    Begin VB.CommandButton cmdDone 
  24.       Caption         =   "Done"
  25.       Height          =   375
  26.       Left            =   4560
  27.       TabIndex        =   6
  28.       Top             =   2640
  29.       Width           =   1095
  30.    End
  31.    Begin VB.PictureBox Picture1 
  32.       Height          =   4335
  33.       Left            =   120
  34.       Picture         =   "frmUpdate.frx":27A2
  35.       ScaleHeight     =   4275
  36.       ScaleWidth      =   1155
  37.       TabIndex        =   4
  38.       Top             =   120
  39.       Width           =   1215
  40.    End
  41.    Begin VB.Line Line2 
  42.       BorderColor     =   &H00808080&
  43.       X1              =   1680
  44.       X2              =   5880
  45.       Y1              =   5083.333
  46.       Y2              =   5083.333
  47.    End
  48.    Begin VB.Line Line1 
  49.       BorderColor     =   &H00FFFFFF&
  50.       BorderWidth     =   2
  51.       X1              =   1680
  52.       X2              =   5880
  53.       Y1              =   5083.333
  54.       Y2              =   5083.333
  55.    End
  56.    Begin VB.Label lblexeprogram 
  57.       Caption         =   "lblexeprogram"
  58.       Height          =   255
  59.       Left            =   1560
  60.       TabIndex        =   10
  61.       Top             =   1440
  62.       Width           =   975
  63.    End
  64.    Begin VB.Label lblexeupdate 
  65.       Caption         =   "lblexeupdate"
  66.       Height          =   255
  67.       Left            =   1560
  68.       TabIndex        =   9
  69.       Top             =   1080
  70.       Width           =   855
  71.    End
  72.    Begin VB.Label lbldownload 
  73.       Caption         =   "lbldownload"
  74.       Height          =   255
  75.       Left            =   1440
  76.       TabIndex        =   8
  77.       Top             =   480
  78.       Width           =   3255
  79.    End
  80.    Begin VB.Label lblremote 
  81.       Caption         =   "lblremote"
  82.       Height          =   255
  83.       Left            =   1440
  84.       TabIndex        =   7
  85.       Top             =   120
  86.       Width           =   2895
  87.    End
  88.    Begin VB.Image imgcircle4 
  89.       Height          =   240
  90.       Left            =   3240
  91.       Picture         =   "frmUpdate.frx":30F1
  92.       Top             =   720
  93.       Width           =   240
  94.    End
  95.    Begin VB.Label Label4 
  96.       Caption         =   "Loading CurVersion..."
  97.       Height          =   255
  98.       Left            =   3600
  99.       TabIndex        =   5
  100.       Top             =   720
  101.       Width           =   2415
  102.    End
  103.    Begin VB.Label lblcopyright 
  104.       Alignment       =   1  'Right Justify
  105.       BackStyle       =   0  'Transparent
  106.       Caption         =   "AutoUpdate Deluxe Copyright 
  107.  ITson 1999-2000"
  108.       BeginProperty Font 
  109.          Name            =   "Times New Roman"
  110.          Size            =   6.75
  111.          Charset         =   0
  112.          Weight          =   400
  113.          Underline       =   0   'False
  114.          Italic          =   0   'False
  115.          Strikethrough   =   0   'False
  116.       EndProperty
  117.       Height          =   255
  118.       Left            =   3000
  119.       TabIndex        =   3
  120.       Top             =   4320
  121.       Width           =   3015
  122.    End
  123.    Begin VB.Image Image1 
  124.       Height          =   480
  125.       Left            =   6120
  126.       Picture         =   "frmUpdate.frx":323B
  127.       Top             =   4080
  128.       Width           =   480
  129.    End
  130.    Begin VB.Image Image2 
  131.       Height          =   1080
  132.       Left            =   5160
  133.       Picture         =   "frmUpdate.frx":59DD
  134.       Top             =   -360
  135.       Width           =   1860
  136.    End
  137.    Begin VB.Image imgcircle3 
  138.       Height          =   240
  139.       Left            =   3240
  140.       Picture         =   "frmUpdate.frx":5BC9
  141.       Top             =   1800
  142.       Width           =   240
  143.    End
  144.    Begin VB.Image imgcircle2 
  145.       Height          =   240
  146.       Left            =   3240
  147.       Picture         =   "frmUpdate.frx":5D13
  148.       Top             =   1440
  149.       Width           =   240
  150.    End
  151.    Begin VB.Image imgcircle1 
  152.       Height          =   240
  153.       Left            =   3240
  154.       Picture         =   "frmUpdate.frx":5E5D
  155.       Top             =   1080
  156.       Width           =   240
  157.    End
  158.    Begin VB.Label Label3 
  159.       Caption         =   "Updating program..."
  160.       Height          =   255
  161.       Left            =   3600
  162.       TabIndex        =   2
  163.       Top             =   1800
  164.       Width           =   2175
  165.    End
  166.    Begin VB.Label Label2 
  167.       Caption         =   "Checking for Updates..."
  168.       Height          =   255
  169.       Left            =   3600
  170.       TabIndex        =   1
  171.       Top             =   1440
  172.       Width           =   2175
  173.    End
  174.    Begin VB.Label Label1 
  175.       Caption         =   "Connecting..."
  176.       Height          =   255
  177.       Left            =   3600
  178.       TabIndex        =   0
  179.       Top             =   1080
  180.       Width           =   2175
  181.    End
  182. Attribute VB_Name = "frmUpdate"
  183. Attribute VB_GlobalNameSpace = False
  184. Attribute VB_Creatable = False
  185. Attribute VB_PredeclaredId = True
  186. Attribute VB_Exposed = False
  187. Dim intLocalVer As Integer
  188. Dim b() As Byte
  189. Dim intRemoteVer As Integer
  190. Dim strRemoteVer As String
  191. Dim doUpdate As Boolean
  192. Dim www
  193. Private Sub cmdDone_Click()
  194. End Sub
  195. Private Sub Command1_Click()
  196. End Sub
  197. Private Sub Form_Load()
  198. On Error GoTo err:
  199. cmdDone.Enabled = False
  200. imgcircle1.Visible = False
  201. imgcircle2.Visible = False
  202. imgcircle3.Visible = False
  203. Label1.Enabled = False
  204. Label2.Enabled = False
  205. Label3.Enabled = False
  206. x = decrypt(frmAutoUpdate.txtKeyPhrase.Text, GetIni(frmAutoUpdate.txtKeyFile.Text, "data", "URL-to-download"))
  207. lbldownload.Caption = x
  208. x = decrypt(frmAutoUpdate.txtKeyPhrase.Text, GetIni(frmAutoUpdate.txtKeyFile.Text, "data", "URL-to-remversion"))
  209. lblremote.Caption = x
  210. x = decrypt(frmAutoUpdate.txtKeyPhrase.Text, GetIni(frmAutoUpdate.txtKeyFile.Text, "data", "Exe-of-Update"))
  211. lblexeupdate.Caption = x
  212. x = decrypt(frmAutoUpdate.txtKeyPhrase.Text, GetIni(frmAutoUpdate.txtKeyFile.Text, "data", "Exe-of-Program"))
  213. lblexeprogram.Caption = x
  214. Let exeupdate = lblexeupdate.Caption
  215. Let exeprogram = lblexeprogram.Caption
  216. '1. Open the local version file and read in the number
  217. Open App.Path & "\curversion.dat" For Input As #1
  218. intLocalVer = CInt(Input(LOF(1), 1))
  219. Close 1
  220. imgcircle4.Visible = False
  221. Label4.Enabled = False
  222. imgcircle1.Visible = True
  223. Label1.Enabled = True
  224. '2. Download the remote version file and read in the number
  225. ' Note: This is all one line:
  226. b() = InetUpdate.OpenURL(lblremote.Caption, 1)
  227. 'InetUpdate.Execute lblremote.Caption
  228. strRemoteVer = ""
  229. For T = 0 To UBound(b)
  230. strRemoteVer = strRemoteVer + Chr(b(T))
  231. intRemoteVer = Int(strRemoteVer)
  232. '3. Compare numbers
  233. imgcircle1.Visible = False
  234. Label1.Enabled = False
  235. imgcircle2.Visible = True
  236. Label2.Enabled = True
  237. If intRemoteVer > intLocalVer Then
  238. 'Note: This is all one line:
  239. If MsgBox("A more recent version of this program exists. Would you like to update it now?", vbYesNo Or vbQuestion) = vbYes Then
  240. doUpdate = True
  241. doUpdate = False
  242. End If
  243. MsgBox "You already have the most recent version of this program."
  244. doUpdate = False
  245. End If
  246. '4. If doupdate = True, then download the latest program exe from the site
  247. If doUpdate Then
  248. 'Note: This is all one line:
  249. b() = InetUpdate.OpenURL(lbldownload.Caption, 1)
  250. imgcircle2.Visible = False
  251. Label2.Enabled = False
  252. imgcircle3.Visible = True
  253. Label3.Enabled = True
  254. Open App.Path & "\" & lblexeupdate.Caption For Binary Access Write As #1
  255. Put #1, , b()
  256. Close 1
  257. Kill App.Path & "\" & lblexeprogram.Caption
  258. Name App.Path & "\" & lblexeupdate.Caption As App.Path & "\" & lblexeprogram.Caption
  259. 'Now save the current version into the local version file
  260. Open App.Path & "\curversion.dat" For Output As #1
  261. Print #1, strRemoteVer
  262. Close 1
  263. MsgBox "Update Complete!"
  264. cmdDone.Enabled = True
  265. End If
  266. If err.Number = 13 Then
  267.    MsgBox "Please make sure you are connected to the Internet." & vbCrLf & "If not, please (re)connect to the Internet." & vbCrLf & vbCrLf & "If you suspect problems with this program" & vbCrLf & "please contact the author of the program or" & vbCrLf & "at ronnie@itson.nu" & vbCrLf & vbCrLf & "Auto Update Deluxe will shutdown", vbExclamation
  268.        End
  269.         End If
  270.     End Sub
  271.