


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.
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.


Adobe AIR? What is your program?<- sorry off topic but interested.
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?
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.
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.
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.
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.
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…
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…
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.
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.
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", vbNormalFocusAnd this will bring up a file page for the user to make their decision as to update or not.
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?
Mariodlg
Thank you for your assistance, but when I click check for updates button now I get
Object required on this line
Prior to this line I told it what “urlToFile” was with a
What object does it need? If you will.
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.
Mariodlg
Yes I did add the component “Microsoft Internet Transfer” and it’s called or named inet1 by default. Any other suggestions?
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.
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 SubIt successfully gets the index.html from my website, and saves it as test.html in my C root directory.
Forgot to escape the backslash:
This line looked incorrect in my previous post:
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?
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.
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.
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 SubI 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.
Great.
This was a nice team work
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.
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.
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.
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.