What’s the best way to check for updates in my program?

1940 pts.
Tags:
Java
PHP
Visual Basic
Visual Basic Functions
Hi all, Here’s my dilemma, I have a visual basic button now that people can press to check for updates on my program, and what it does is msgbox’s them their current version and then brings them to my updates web page where they can compare what the latest there is compared to what they have, they do all the work and it works, they then can get the update or not. What I would like to know is what is the best way to have this visual basic link call a file of some type and have it let you know with a msgbox if there is a newer update or not and if there is, then it would bring you to the file to get it. What are the best tools for this? Any and all help is appreciated.

Software/Hardware used:
PC, Windows

Answer Wiki

Thanks. We'll let you know when a new response is added.

A simple form could be to create a webservice that returns latest build number of your program. Then dote your program with a function to consume the webservice and compare its version with the latest version obtained from the webservice.

Regards.

Discuss This Question: 30  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • RamseyB
    Adobe AIR? What is your program?<- sorry off topic but interested.
    2,115 pointsBadges:
    report
  • TheFinder
    Mariodlg, I would like it to do it through a msgbox while program is still running and not via e-mail, I have a form now using .PHP that I'm playing with, but don't know how to get it to msgbox only e-mails. Any suggestions?
    1,940 pointsBadges:
    report
  • TheFinder
    RamseyB I have a few different programs your welcomed to check them out if you'd like you can find them at https://www.birthdayfinder.org/ one is called Date Minder the other is Chance Plosion.
    1,940 pointsBadges:
    report
  • Mariodlg
    Ok, I meant that your program could open a connection to your website and retreive the lastest build number using your PHP form or a webservice. A webservice is an elegant way to provide some information to everybody that wants to consume it, like your program. If you choose to use your php form then your program has to open a http connection, fill the required fields in the form and make the request to get the information. If you choose to use a webservice then you need to develop a webservice in any language you can and publish it in your website, then you need to add "websevice client" capabilities to your program in order to consume the webservice to get the information. Regardless of the method used your program can check this information in the time it runs and if there is a new version show the messagebox saying so and then redirect to your download page when the user click the message. I don't know if I am understanding your needs, but I think this can be a posible solution. Here are some links to learn about webservice. This techniques is well used over the internet. Webservices Deploying webservices in php Calling webservices from visual basic application Hope it helps you.
    2,790 pointsBadges:
    report
  • TheFinder
    Mariodlg Thank you, I'll have to look at this more and see, but I think you hit it correctly, I've been out of the loop for about 7 years, retired, and living way out in the boonies I’m not up on some of this latest stuff, and this one flew right over me, Thank you for your insight, and I will see what I can find along the lines you mention, again Thank you.
    1,940 pointsBadges:
    report
  • Chippy088
    There are many applications that have that feature built into the program, and automatically connect to company servers to check for updates. (Adobe's PDF application is 1 off the top of my head.) Have you thought of doing it that way, it would need less user intervention, and it would leave the user to get on with the task, without having to worry about checking for updates every time they used the app. I'm thinking, as you already have a version number in the app, because you said it gives the current version in a message box. So, would it be better to write a function that ran in the background on starting the application. it would get the version from the app and sent it off to your server, where it would be compared, and a 'download new version' message box would be triggered if there was an update.
    4,625 pointsBadges:
    report
  • Koohiisan
    To be simpler, you could place a small file on your site that lists the current version of your program. Your VB program could then retrieve that tiny text file and compare its contents to the internal version of the program. If they want to download it, just use the shell function to send them to "http:////[yoursite]//[latestver].exe". Their browser will run (since it is an http request you are shell'ing to) and it is smart enough to know to prompt the user as to whether they want to run it or save it. Oh, and once you shell to the browser, you'd want to end your program right away, so that they are able to run your newer installer and not have any file locking issues. Hope that makes sense... :)
    5,020 pointsBadges:
    report
  • Koohiisan
    Sorry, I thought I had to escape the slashes in my post for them to show up! Just pretend it looks like a normal web url... :(
    5,020 pointsBadges:
    report
  • TheFinder
    Koohiisan What type of coding in vb to grab, read, and decide it it's current version is older or newer, I like everything you say, that is what I've been trying to do but to no avail yet, how, what do I need? Thank you for your answer.
    1,940 pointsBadges:
    report
  • TheFinder
    Chippy088 I'm not sure of what it is that your saying, PDF has it, yes, but that is a whole different program in itself and the way they do it is not public information, but yes something similar is what I would like to do.
    1,940 pointsBadges:
    report
  • TheFinder
    I’m not sure as to how to go out and get file information without using shell. Here’s a bit of my coding below so you can see how I’m currently doing it, but as you re-call I want to do it more or less in the background and with msgbox’s not shell.
    MsgBox "Your version dated" & Chr$(10) & "       5/22/2011"
    strpath = ie.FullName 'this returns the default browser's location
        Shell strpath & " https://mywebaddress/filename.html", vbNormalFocus
    
    And this will bring up a file page for the user to make their decision as to update or not.
    1,940 pointsBadges:
    report
  • Mariodlg
    Well, Koohiisan gave you another way to check your lastest version. I agree with his suggestions. Following the mentioned method I think you can download the desired file using the component called "Microsoft Internet Transfer". Maybe these few lines are useful.
    
    Dim bytes() As Byte
    Dim fnum As Integer
    
         'Get the bytes
        bytes() = inet1.OpenURL( urlToFile, icByteArray) 
    
        ' Save the file.
        fnum = FreeFile
        Open yourfilename For Binary Access Write As #fnum
        Put #fnum, , bytes()
        Close #fnum
    
    
    Regards.
    2,790 pointsBadges:
    report
  • Mariodlg
    Thinking a little more, previous code I posted here could be used to download the new version installer. First, download the text file using the suggested method and compare its contents to your current version number, then if it is needed, download the new version installer using the same method again. How about that?
    2,790 pointsBadges:
    report
  • TheFinder
    Mariodlg Thank you for your assistance, but when I click check for updates button now I get Object required on this line
    bytes() = inet1.OpenURL( urlToFile, icByteArray) 
    
    Prior to this line I told it what "urlToFile" was with a
     urlToFile = "http://mywebaddress/file.txt"
    What object does it need? If you will.
    1,940 pointsBadges:
    report
  • Mariodlg
    Did you add the Internet Transfer component to your form? If so modify "inet1" in that line with the name you gave to your component. I have no visual basic here to test the code but tell us your results. Regards.
    2,790 pointsBadges:
    report
  • TheFinder
    Mariodlg Yes I did add the component "Microsoft Internet Transfer” and it's called or named inet1 by default. Any other suggestions?
    1,940 pointsBadges:
    report
  • TheFinder
    After moving the code to the actual module itself instead of doing a call too the code I get A URL is malformed error on this line bytes() = inet1.OpenURL(urlToFile, icByteArray) I’m not giving up, but don’t know what to do to fix it yet.
    1,940 pointsBadges:
    report
  • carlosdl
    Kurt, are you sure that is the line that is causing the error ? I created a small program to test the code, and it works for me (usgin vb6). This is the code I tested:
    Private Sub Command1_Click()
    
    Dim bytes() As Byte
    Dim fnum As Integer
    Dim urltofile As String
    
         'Get the bytes
        urltofile = "http://www.cadlg.com/yes/index.html"
        bytes() = Inet1.OpenURL(urltofile, icByteArray)
    
        'Save the file.
        fnum = FreeFile
        Open "c:test.html" For Binary Access Write As #fnum
        Put #fnum, , bytes()
        Close #fnum
    
    End Sub
    It successfully gets the index.html from my website, and saves it as test.html in my C root directory.
    69,835 pointsBadges:
    report
  • carlosdl
    Forgot to escape the backslash: This line looked incorrect in my previous post:
    Open “c:\test.html” For Binary Access Write As #fnum
    69,835 pointsBadges:
    report
  • Mariodlg
    I think I need visual basic to test the code before to post again. Let me some time to do that and I will write back. In the mean time, people have you any suggestion for this error?
    2,790 pointsBadges:
    report
  • TheFinder
    Hi Carlosdl it's been a while, I'm using VB4 I have VB6 but for reasons too long to report here, I like and use vb4 it also has the Microsoft internet tools (module) mentioned, I will try / test your code in VB4 and report back, thank you for your efforts.
    1,940 pointsBadges:
    report
  • TheFinder
    Ok, it’s getting close, now it does get the file date from a text file, and it writes that date to a file on my c:/ drive, so were half way there, thanks to all who assisted thus far, What I want now it for it not to write to file, but to msgbox a msgbox of this data for now. If / after I get that, then I can modify the msgbox. The earlier problem seems to be that in VB6 the open and closed quotes are a different character and because I was just testing code, I did a copy and paste.
    1,940 pointsBadges:
    report
  • carlosdl
    Ok, that is simpler. Use a string variable, instead of a byte array: Try this:
    Private Sub Command1_Click()
    
    Dim data As StringDim urltofile As String
    
        urltofile = "http://<your_address>/version.txt"
        data = Inet1.OpenURL(urltofile, icString)
    
        MsgBox (data)
    
    End Sub
    69,835 pointsBadges:
    report
  • TheFinder
    I guess I can work with this, I can now just open the local file in background and then do a comparison of file dates and then act accordingly. Thank you all very much for your help. I do believe this will work for what I’m trying to do.
    1,940 pointsBadges:
    report
  • carlosdl
    Great. This was a nice team work ;-)
    69,835 pointsBadges:
    report
  • TheFinder
    I agree totally with you Carlosdl this was great team work, almost brings me back to the day when I was at work, very nice of all of you to assist me in this. I just did some coding and it’s working just as I wanted it to do, so now I’ll have to transpose to the actual programs that it will be going to and hope it all goes well there. One more big Thank you to all of your who assisted, it was very nice working with you.
    1,940 pointsBadges:
    report
  • Mariodlg
    Don't forget to put DoEvents instruction to do this in background. Great question -> great answers! Thanks to Carlos for trying out the code, enrich and ensure its functionality.
    2,790 pointsBadges:
    report
  • TheFinder
    Yes Mariodlg, Thank you, it's working now just the way I wanted it to work, Thanks to you and others from this site. I was originally thinking way too complicated of means using PHP files, etc and it’s all do-a-ble with out that, but only a simple .txt file and the Wonderful Microsoft internet transfer control, that’s a new one for me, but a very good control tool, of which now I will use many times. Thank you again for your assistance and knowledge.
    1,940 pointsBadges:
    report
  • TheFinder
    I tried to post this as a new post but got the error msg, that the site had a programming error and it would not let me, so I posted here. Ok folks, here we go again, I hope. Yesterday I learned about a new module in Visual Basic called Microsoft Internet transfer control, new to me anyways, And it was to get me information from the net to my program, now I’d like to learn how to go the other way, I want to put data in a file that is sitting on the root of my server. Can you assist in showing me this procedure? Thank you in advance for your time and patience in this matter. I can do it locally but don’t know how or what the procedure is for putting data in a file on the Internet. Oh, yea, I would like to learn both append and write data.
    1,940 pointsBadges:
    report
  • TheFinder
    [...] 10. Check out the great discussion and Mariodlg’s approved answer to TheFinder’s inquiry about the best way to check for updates in his program. [...]
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following