
so i will show you how to make UpDater to your Program

The main program use to download the updates and the second to make the needed updates and restart the main program
lets begin place button Update and Inet control (you need component-> Mircrosoft Internet Control 6.0 (or "C:\Windows\system32\MSINET.OCX")
Make your Inet control propery "Protocol" to "4-icHTTP"
So now you have all your controls in place lets code

So hiting button Update will beging down loading from the URL you have enter and begin downloading in specify location to do this we make the variables
FileName the name of the file you want to download
URLName the http server where you got the file
FileToGet it is the url and filename combine in one
then a second program will start but first next download our new version
so lets begin
we will fill our variables with the specf. name and url and download the file.
all will do our Inet Control the function "Execute" do all thing.
here is description of that function :
Sub Execute([URL], [Operation], [InputData], [InputHdrs])
Member of InetCtlsObjects.Inet
Issue a request to the remote computer
Then we use the Shell to start our updater
for that we need the varialbe for our updater path
FilePth is used for that here is where our Updater path is containt, we add at the end and our file name as well
so the code
CODE
Private Sub cmdUpdate_Click()
On Error GoTo err_hndl
Dim FileName As String ' Contain the file name
Dim URLName As String 'Contain the URL for our http server
Dim FileToGet As String ' Used to combine urlname and filename variable
Dim 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 & FileName
Inet1.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 program
End
Exit Sub
err_hndl:
MsgBox Err.Description, vbCritical
End Sub
So for now we download the file to update and we start our updater
Now for the Updater Program
Make new project on VB6
Add reference "Microsoft Scripting Runtime" or From Browse button add "C:\WINDOWS\system32\scrrun.dll"
so we make few variables as well

NewFile As String is used to show the location of the new version of the file that we want to update
PathToCopy As String is used to location where we want to put it in our main program
Process As Long is used to open the process of our main program
StartingPrgrm As String is used to show the location of the exe of our main program so we can start it again
so we use "Microsoft Scripting Runtime" to copy the the the new location then we start our main program and end the updater
so here is the code
CODE
Private Sub Form_Load()
On Error GoTo err_hndl
Me.Visible = False
Dim NewFile As String
Dim PathToCopy As String
Dim StartingPrgrm As String
Dim Process As Long
NewFile = "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, PathToCopy
End With
StartingPrgrm = "The path of your main program example "C:\MyProgra\""
StartingPrgrm = StartingPrgrm & "MyExe.exe"
Process = Shell(StartingPrgrm, vbNormalFocus)
End
Exit Sub
err_hndl:
MsgBox Err.Description, vbCritical
End
End Sub
WARNING: This Updater will not work on updating exe of your main program. Make a Delay in updater to wait your main program is closed!!!!!! Hope you find it useful
This post has been edited by NoBrain: 15 Oct, 2009 - 01:48 PM