Author | Message | Time |
---|---|---|
Clan CDH | How would I make an updater for one of my programs that checks every time you startup the program for it to update if there is a new version available? I really want it to be PHP based because I know how to read it and I know it's probably the simplest way to do it. I'll be posting this questions in similar forums hoping to get an answer asap. | June 2, 2006, 4:26 AM |
Myndfyr | One thing you should know is that your executables can't be overwritten while they're in memory. | June 2, 2006, 6:38 AM |
FrOzeN | On some webpage just have a file called "version.txt", then inside it just in plain text have the latest version, eg "1.2.0". In your Visual Basic project, when it loads. You should call a function to access this webpage (probably easiest done with Inet, better to do with Winsock) and check to see if your .exe's version is the same as the one on the webpage. If it's not, tell the user that there program is out of date and provide them with a link to a new version, or setup your project to download the new version (which could be difficult). Note that if you call Inet(), place the call in another function which has DoEvents above the call of Inet. This way your program doesn't freeze up while it checks the version. You don't need php to do this. | June 2, 2006, 11:10 AM |
Spht | There are several ways to do this. If I recall correctly, Userloser's CheckVersion.bcp downloads a binary file on a web server that contains the latest build number, and compares that with the local copy and notifies the user of an update if it is different. In WebBot, I utilize Botnet databases, and always keep an entry that is the current build information (this contains the build date, version info, and build number). On each connect when the database is downloaded the user is notified and complete download instructions are presented if there is an update available. Additionally, due to the nature of Botnet database updates, when a new version is published, all online Webbots are immediately notified of the update automatically. | June 2, 2006, 1:09 PM |
JoeTheOdd | [code]If Inet1.OpenURL("http://some.web.server/path/sometextfile.txt") = App.Major & "." & App.Minor & "." & App.Revision Then ' Current Else ' Upgrade End If[/code] | June 2, 2006, 1:27 PM |
Clan CDH | some guy on the stealthbot forums told me to use msinet.ocx and it gives me an error, as for winsock, i really haven't learned it yet. im trying a method that someone posted on another forum but this is by far the most helpful one that i've used so far. thx and i could use some other input since i cant use the msinet.ocx anyways i just tried this other method and it did not work, it was a post at vbcity made here and it did not work. anyways i would try J's thing if the inet was working for me but i have to get a license thing and i'm using enterprise edition | June 2, 2006, 4:40 PM |
FrostWraith | [quote author=Clan CDH link=topic=15111.msg153683#msg153683 date=1149266416] anyways i would try J's thing if the inet was working for me but i have to get a license thing and i'm using enterprise edition [/quote] Did you register it like FrOzeN explained? | June 2, 2006, 5:21 PM |
Clan CDH | ya i did, do that if u saw my reply and i got it to work i needed the stupid vbclient to install the licenses for me so i just got that working | June 2, 2006, 6:03 PM |
rabbit | As for winsock, which is by far the better method, use this: http://www.jmarshall.com/easy/http/ Specifically GET, as POST really is just not necessary at all for this sort of thing. | June 2, 2006, 10:02 PM |
Clan CDH | my pro friend says inet is way better but he cant help me right now cuz he's on vacation. | June 5, 2006, 4:28 AM |
UserLoser | [quote author=MyndFyre[vL] link=topic=15111.msg153653#msg153653 date=1149230336] One thing you should know is that your executables can't be overwritten while they're in memory. [/quote] Not even with VirtualProtect, then dumping the memory block to a binary file?! | June 5, 2006, 4:38 AM |
HdxBmx27 | Heres a bad way to do it. But it works. [code]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 patched as boolean Private Sub Form_Terminate() If patched Then x = Shell(App.Path & "\update.bat") End Sub Public Sub Update() If Inet.openURL("http://some.place.on.the.web/myProggie/currentver.txt") <> App.Major & "." & App.Minor & "." & App.Revision Then MsgBox "OMGEEZ J00S NOT UPDATED!!! UPDATORZING NOWZORZ LAWLEZ!!" Call URLDownloadToFile(0, "http://some.place.on.the.web/myProggie/Current.exe", App.Path & "\update.exe", 0, 0) Open App.Path & "\update.bat" For Output As #1 Print #1, "ren " & App.EXEName & ".exe " & "OLD_VER-" & App.Major & "." & App.Minor & "." & App.Revision & ".exe" Print #1, "ren update.exe " & App.EXEName & ".exe" Print #1, "run " & App.EXEName & ".exe" Close #1 patched = True For Each frm In Forms Unload frm Next frm Else MsgBox "OMG JOOS UPDATED!! 1337 YOEZ!!!" End If End Sub[/code] Note: I'm extreamly bored sitting in class so I wrote this in like 2 mins ~-~(HDX)~-~ | June 5, 2006, 4:44 PM |
Clan CDH | [quote author=HdxBmx27 link=topic=15111.msg153850#msg153850 date=1149525860] Heres a bad way to do it. But it works. [code]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 patched as boolean Private Sub Form_Terminate() If patched Then x = Shell(App.Path & "\update.bat") End Sub Public Sub Update() If Inet.openURL("http://some.place.on.the.web/myProggie/currentver.txt") <> App.Major & "." & App.Minor & "." & App.Revision Then MsgBox "OMGEEZ J00S NOT UPDATED!!! UPDATORZING NOWZORZ LAWLEZ!!" Call URLDownloadToFile(0, "http://some.place.on.the.web/myProggie/Current.exe", App.Path & "\update.exe", 0, 0) Open App.Path & "\update.bat" For Output As #1 Print #1, "ren " & App.EXEName & ".exe " & "OLD_VER-" & App.Major & "." & App.Minor & "." & App.Revision & ".exe" Print #1, "ren update.exe " & App.EXEName & ".exe" Print #1, "run " & App.EXEName & ".exe" Close #1 patched = True For Each frm In Forms Unload frm Next frm Else MsgBox "OMG JOOS UPDATED!! 1337 YOEZ!!!" End If End Sub[/code] Note: I'm extreamly bored sitting in class so I wrote this in like 2 mins ~-~(HDX)~-~ [/quote] thx im tryin this out now edit: i keep getting an error on this line(its the object required error) [Quote] If Inet.OpenURL("http://mehateeggz.googlepages.com/CurrentVer.txt") <> App.Major & "." & App.Minor & "." & App.Revision Then [/Quote] | June 5, 2006, 5:56 PM |
l2k-Shadow | You need to load inet into your app, (internet file transfer protocol) or something like that it should be called in your components (CTRL+T) directory. | June 5, 2006, 7:25 PM |
Clan CDH | [quote author=l2k-Shadow link=topic=15111.msg153855#msg153855 date=1149535511] You need to load inet into your app, (internet file transfer protocol) or something like that it should be called in your components (CTRL+T) directory. [/quote] i know, i m not that newbish, i think it might be a problem with my text file? http://mehateeggz.googlepages.com/CurrentVer.txt | June 5, 2006, 7:30 PM |
l2k-Shadow | [quote author=Clan CDH link=topic=15111.msg153856#msg153856 date=1149535809] [quote author=l2k-Shadow link=topic=15111.msg153855#msg153855 date=1149535511] You need to load inet into your app, (internet file transfer protocol) or something like that it should be called in your components (CTRL+T) directory. [/quote] i know, i m not that newbish, i think it might be a problem with my text file? http://mehateeggz.googlepages.com/CurrentVer.txt [/quote] Well you said that it is throwing an object required error. And by definition object required error means that you are trying to call an object that is not there, which in this case you are calling an INET control, which the VB has detected missing, so therefore that is the only problem that is able to be associated with this error in this line of code. | June 5, 2006, 7:32 PM |
Clan CDH | [quote author=l2k-Shadow link=topic=15111.msg153857#msg153857 date=1149535962] [quote author=Clan CDH link=topic=15111.msg153856#msg153856 date=1149535809] [quote author=l2k-Shadow link=topic=15111.msg153855#msg153855 date=1149535511] You need to load inet into your app, (internet file transfer protocol) or something like that it should be called in your components (CTRL+T) directory. [/quote] i know, i m not that newbish, i think it might be a problem with my text file? http://mehateeggz.googlepages.com/CurrentVer.txt [/quote] Well you said that it is throwing an object required error. And by definition object required error means that you are trying to call an object that is not there, which in this case you are calling an INET control, which the VB has detected missing, so therefore that is the only problem that is able to be associated with this error in this line of code. [/quote] i know, but it's not missing the inet control because i have it in there, it highlights that whole line, i believe it might be in the app.major, could that be possible? edit: here's my form maybe im doing something wrong http://mehateeggz.googlepages.com/Updater.frm | June 5, 2006, 8:34 PM |
warz | [code] If Inet.OpenURL("http://mehateeggz.googlepages.com/CurrentVer.txt") <> App.Major & "." & App.Minor & "." & App.Revision Then [/code] I'm not sure if i'm correct - but wouldn't it be better in this case to use a string comparison function rather than greater than or less than? Would App.Major & "." & App.Minor & "." & App.Revision be treated as a string? I don't think it'd be treated as any numerical data. Maybe try something similar to strcmp, or something. If you are infact allowed to use greater than or less than on two strings, then it might be better to enclose the values to the right of the comparison operators in parenthesis so it does the & operations, and then looks at the entire string, because it might be trying to do this: [code] if (Inet.OpenURL("http://mehateeggz.googlepages.com/CurrentVer.txt") <> App.Major) & "." & App.minor [...] [/code] | June 5, 2006, 11:28 PM |
rabbit | Cascade checks should be used. IE: Check the major version first. If the supplied is lower than the check, update, otherwise move on to the minor version, do the same, and move on the to revision. | June 6, 2006, 12:06 AM |
HdxBmx27 | [quote author=warz link=topic=15111.msg153874#msg153874 date=1149550122] I'm not sure if i'm correct - but wouldn't it be better in this case to use a string comparison function rather than greater than or less than? Would App.Major & "." & App.Minor & "." & App.Revision be treated as a string? I don't think it'd be treated as any numerical data. Maybe try something similar to strcmp, or something. If you are infact allowed to use greater than or less than on two strings, then it might be better to enclose the values to the right of the comparison operators in parenthesis so it does the & operations, and then looks at the entire string, because it might be trying to do this: [code] if (Inet.OpenURL("http://mehateeggz.googlepages.com/CurrentVer.txt") <> App.Major) & "." & App.minor [...] [/code] [/quote] Well, VB being the newbish languuage it is, dosent matter. The strings are conceated(sp?) before the comparisions are done. Therefor my line works fine. [quote author=rabbit link=topic=15111.msg153877#msg153877 date=1149552400] Cascade checks should be used. IE: Check the major version first. If the supplied is lower than the check, update, otherwise move on to the minor version, do the same, and move on the to revision. [/quote] Why? we're talking to a kiddie here, using VB. I honestly don't think it should be cascading, when it all can be done in one move. Oh well, w/e [quote author=Clan CDH link=topic=15111.msg153861#msg153861 date=1149539691]i know, but it's not missing the inet control because i have it in there, it highlights that whole line, i believe it might be in the app.major, could that be possible? edit: here's my form maybe im doing something wrong http://mehateeggz.googlepages.com/Updater.frm [/quote] Yes you are missing the 'Inet' control. Your control is named 'Inet1' It MUST be named 'Inet', considering you have the 1, it cant find it! There for you get the error!!! DUA! Anyways. Pay attention boyo :P My code works FINE, I tested it many times in 2rd period, many times. (Our school has a personal HTTP server in each lab(for php programming) and I have access to them all <3) ~-~(HDX)~-~ | June 6, 2006, 12:38 AM |
rabbit | It's a lot easier to cascade than to compare strings. | June 6, 2006, 1:27 AM |
Clan CDH | woops i didn't see that i guess >_< imma go in and beat me self over the head now | June 6, 2006, 2:59 AM |
l2k-Shadow | AFAIK, upon compilation, VB changes the <> to StrComp() when comparing strings. | June 6, 2006, 7:24 PM |
warz | [quote author=l2k-Shadow link=topic=15111.msg153925#msg153925 date=1149621841] AFAIK, upon compilation, VB changes the <> to StrComp() when comparing strings. [/quote] eh, i doubt that. | June 6, 2006, 7:45 PM |
rabbit | AFAIK it changes it to two different calls: a <> b becomes a < b and a > b | June 6, 2006, 8:49 PM |
warz | AFAYK. | June 6, 2006, 9:10 PM |
rabbit | [quote author=warz link=topic=15111.msg153933#msg153933 date=1149628244] AFAYK. [/quote]Yes...I pinch. | June 7, 2006, 12:12 AM |
inner. | Not sure if anyone has given him a solution, but Clan CDH, if you want my code I made for my bot for auto-updating, I'll give you it. | June 14, 2006, 4:49 PM |
HdxBmx27 | June 14, 2006, 10:58 PM |