|
-
Sep 17th, 2004, 02:18 PM
#1
Thread Starter
Junior Member
A program that updates itself
dear all
i am working on VB 5 and i want to make a program that updates itself automatically from the internet, in order to do so, i need to know how to make that program download a file from a site (that is the zip containing the new version)
i'd be glad to hear from you about that, specially with code, i hope you don't use code that needs dlls or ocxs, just APIS and natural coding
thanks and all the best
-
Sep 17th, 2004, 02:22 PM
#2
-
Sep 17th, 2004, 03:02 PM
#3
PowerPoster
I think he means, you know for example when your virus scanner connects to its company's server and checks for udpates...if there is one, then it downloads and installs.
Now, depends what you are updating, when it comes to VB...You are probably updating the exe, which means you might as well forget about it and just tell the user to update himself when the time comes.
You can use a function which compares the size of one file to another. Have the server send back the size of the exe and compare it with the running exe...If they are the same, then version is up to date, if they are different then tell the user to download one.
It aint hard to download files off the net using winsock, but it is hard to write your own unzipping routines.
If you want actually code, I'll post some, but it will be general, and you must ask what you want code for...Do not ask me to code the entire project, just examples.
"From what was there, and was meant to be, but not of that was faded away." - - Steve Damm
"The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm
"When you do things right, people won't be sure if you did anything at all." - - God from Futurama
-
Sep 17th, 2004, 06:02 PM
#4
To download the updated file you can use the code below. HTH 
VB Code:
Option Explicit
Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
"URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, _
ByVal szFileName As String, ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long
Private Sub Form_Load()
Dim url As String
Dim localFileName As String
Dim filedownload As Long
url = "http://www.yourURL.com/YourFile.zip" 'URL of update file
localFileName = App.Path & "\YourFile.zip" 'Location where to download file
filedownload = URLDownloadToFile(0, url, localFileName, 0, 0) 'Download file
End Sub
-
Sep 18th, 2004, 01:03 AM
#5
Hyperactive Member
You can do this but you need 2 executables. One the actual program and the other an installer.
Use the code listed above to download the update files. Call the installer program with the update files as a parameter and close the main program.
The installer is then free to update the main program, restart it and then close itself.
Whalah!
Now do NOT be using this to autoload spyware on peoples machines.
The Mav
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|