I’m wondering if someone has an example on how can be used the TJvProgramVersionCheck component performing the check via HTTP.
The example in the JVCL examples dir doesn’t show how to use HTTP
thank you
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The demo included in your
$(JVCL)\Examples\JvProgramVersionCheckfolder seems to be able to do so. Edit the properties of theJVProgramVersionHTTPLocation, and add the URL to it’sVersionInfoLocationlist (aTStrings). You can also set up any username, password, proxy, and port settings if needed.You also need to add an
OnLoadFileFromRemoteevent handler. I don’t see anything in the demo that addresses that requirement, but the source code says:It appears from the parameters that event receives that you do your checking there:
So you’ll need to add an event handler for this event, and then change the
TJVProgramVersionCheck.LocationTypeproperty topvltHTTPand run the demo. After testing, it seems you’re provided the server and filename for the remote version, and a local path and temp filename for the file you download. The event handler’sResultshould be the full path and filename of the newly downloaded file. Your event handler should take care of the actual retrieval of the file.There are a couple of additional types defined in
JvProgramVersionCheck.pas, (TJvProgramVersionHTTPLocationICSandTJvProgramVersionHTTPLocationIndy, both protected by compiler defines so they don’t exist in the default compilation. However, setting theICSrelated define resulted in lots of compilation errors (it apparently was written against an old version ofICS), and setting theIndydefine (and then setting it again to useIndy10instead) allowed it to compile but didn’t change any of the behavior. I’m going to look more into this later today.Also, make sure that the
VersionInfoLocationentry is only the URL (without the filename); the filename itself goes in theVersionInfoFileNameproperty. If you put it in the URL, it gets repeated (as inhttp://localhost/Remote/ProjectVersions_http.iniProjectVersions_http.ini, and will fail anyway. (I found this while tracing through the debugger trying to solve the issue.)Finally…
The solution is slightly (but not drastically) complicated. Here’s what I did:
Copy
JvProgramVersionCheck.pasto the demo folder. (It needs to be recompiled because of the next step.)Go to Project->Options->Directories and Conditionals, and add the following line to the
DEFINESentry:Delete the
JvProgramVersionHTTPLocationcomponent from the demo form.Add a new
privatesection to the form declaration:In the
FormCreateevent, add the following code:In the
ProgramVersionCheckcomponent properties, expand theVersionInfoFileOptionsproperty, and change theFileFormatfromhffXMLtohffIni.Delete or rename the
versioninfolocal.inifrom the demo’s folder. (If you’ve run the app once, it stores the http location info, and the changes above are overwritten. This took a while to track down.)Make sure your local http server is running, and the
ProjectVersions_http.inifile is in the web root folder. You should then be able to run the demo. Once the form appears, click on theEdit Historybutton to see the information retrieved from the remote version info file. You’ll also have a new copy of theversioninfolocal.inithat has the saved configuration info you entered above.