Source Code Program Updater

download Source Code Program Updater

If you can't read please download the document

description

VB6

Transcript of Source Code Program Updater

Private Sub cmdUpdate_Click()On Error GoTo err_hndlDim FileName As String ' Contain the file nameDim URLName As String 'Contain the URL for our http serverDim FileToGet As String ' Used to combine urlname and filename variableDim FilePth As String ' The path to our updater Dim Process As Long ' Downloading the file FileName = "Place your file name here (example: test.txt)"URLName = "Place your URL here (example: http://myurlspace.com/)"FileToGet = URLName & FileNameInet1.Execute FileToGet, "GET " & Chr(34) & App.Path & "\" & FileName & Chr(34)' File is downloaded and the updater is started FilePth = "C:\Documents and Settings\Raziel\Desktop\me Tutorials\DIC\Updated Program\Updater\"FilePth = FilePth & "MeUpdt.exe"Process = Shell(FilePth, vbNormalNoFocus)' Close the programEndExit Suberr_hndl:MsgBox Err.Description, vbCriticalEnd SubPrivate Sub Form_Load()On Error GoTo err_hndlMe.Visible = FalseDim NewFile As StringDim PathToCopy As StringDim StartingPrgrm As StringDim Process As LongNewFile = "The path and the name of the file you want to copy example "C:\test.txt""PathToCopy = "The path where you want to copy the file example : "C:\MyProgram\""With New FileSystemObject.CopyFile NewFile, PathToCopyEnd WithStartingPrgrm = "The path of your main program example "C:\MyProgra\""StartingPrgrm = StartingPrgrm & "MyExe.exe"Process = Shell(StartingPrgrm, vbNormalFocus)EndExit Suberr_hndl:MsgBox Err.Description, vbCriticalEndEnd Sub