Results 1 to 7 of 7

Thread: how to force my applic for version upgrade remotly?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Arrow how to force my applic for version upgrade remotly?

    I am developing a vb6 application and releasing it to many users. I wonder how i can force the users of my application to upgrade when new version of my application is released. Like when they try to open my applicatoin they recive a massage box that new version is availabe and they click on yes to upgrade and no to close the application.At this moment i just i care about how i can send them such massage box . I be happy if i get some solutions for this issue.Thanks

  2. #2
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: how to force my applic for version upgrade remotly?

    you can have the version number saved in a textfile on your web host, and have the app check the textfile to see if its a bigger version number.

    You could use an Inet control to get the textfile data, project>componants>microsoft internet transfer control

    VB Code:
    1. Private Sub Form_Load()
    2.      Dim LatestVersion as Single
    3.      Dim CurrentVersion as Single
    4.  
    5.      CurrentVersion = 1.2
    6.  
    7.      LatestVersion = Val(Inet1.OpenURL("http://yoursite.com/textfile.txt"))
    8.  
    9.     If LatestVersion > CurrentVersion Then
    10.          Msgbox "There is a new version available!!!!"
    11.     end if
    12.  
    13. End Sub

    there is no error checking in that code, it simply does what you wanted and alerts the user if theres a newer version.

    if the text file contains nothing, doesnt exist, or the host is down, you may get an error, so you could put some basic error checking in easily. Also it will error if you have a version number with more than 1 decimal point such as 3.2.3 or 3.2a. But you get the idea of how to do it, you should be able to fix those errors by using a string instead of a single

    for the above code to work without error, the textfile must contain only 1 line of text which is the version number, no new lines or spaces. So it should look like this
    Code:
    3.1
    Last edited by the182guy; Apr 15th, 2006 at 09:17 AM.
    Chris

  3. #3
    Addicted Member
    Join Date
    Mar 2006
    Posts
    186

    Re: how to force my applic for version upgrade remotly?

    Something like this should do:
    VB Code:
    1. Private Sub Command1_Click()
    2. Dim NewVer As String, OldVer As String, MyURL
    3.  
    4. 'Version on users computer:
    5. OldVer = App.Major & App.Minor & App.Revision
    6.  
    7. 'This file should contain new version for example "1.2.5": 125
    8. MyURL = "http://www.domain.com/file.txt"
    9.  
    10. 'Download New version from your server:
    11. NewVer = Inet1.OpenURL(MyURL)
    12.  
    13. 'Compare the two, and if yours newer, then warn the user.
    14. If NewVer > OldVer Then MsgBox "You're using an older version!"
    15. End Sub

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Arrow Re: how to force my applic for version upgrade remotly?

    Many thanks for both of u i got it working :-)) i have one question if i want to disable older versions completely so the user could not use the application at all even offline and also online how i can achive that task and prompt them for upgrade or the application get closed.Thanks

  5. #5
    Addicted Member
    Join Date
    Mar 2006
    Posts
    186

    Re: how to force my applic for version upgrade remotly?

    In the last line ...
    VB Code:
    1. If NewVer > OldVer Then MsgBox "Youre using an older version!"

    Modify to this:

    VB Code:
    1. If NewVer > OldVer Then
    2.     MsgBox "Youre using an old version, please visit [url]http://www.site.com[/url] to get your upgrade."
    3.     End
    4. End If

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Re: how to force my applic for version upgrade remotly?

    Thanks foxter. I tried your code but now when i start my app i get this error :


    I get Run-time error '35752' URL is malformed


    The 182guy i tired your code and it worked .could u tell me tell me how i check if the server is down or there is no internet and i warn the user acordingly and not to allow my application start?Thanks
    Last edited by tony007; Apr 15th, 2006 at 11:20 AM.

  7. #7
    Addicted Member
    Join Date
    Mar 2006
    Posts
    186

    Re: how to force my applic for version upgrade remotly?

    make sure your file.txt has only numbers and no extra lines.
    aslo, you can check how your file.txt is downloaded like this:
    VB Code:
    1. Text1.Text = Inet1.OpenURL("http://www.site.com/file.txt")
    the text box will show you the contents of the downloaded file.txt

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width