Check the new version of the program
lazarus / 38-Networking and Web Programming
----------------------------------------------------------------------
Aeternitas · 2013-01-04 17:01
Hi,
I create program in Lazarus and I'd like to check on the start if
there is a newer version of the program in internet at my website. If
so, I want to offer to download the file.
How can I do it?
Os: Win 64/32 bit
Thank you in advance.
----------------------------------------------------------------------
Leledumbo · 2013-01-04 18:08
What service do your website offer? Latest version check? If yes, then
you can simply compare the current program version with the one
returned from the website and offer a download of the new program. Use
any networking lib available: fcl-web (TFPHTTPClient), synapse, lnet,
indy, benibela internet tools, etc.
----------------------------------------------------------------------
Aeternitas · 2013-01-04 18:18
Quote from: Leledumbo on January 04, 2013, 07:08:22 pmWhat service do
your website offer? Latest version check? If yes, then you can simply
compare the current program version with the one returned from the
website and offer a download of the new program. Use any networking
lib available: fcl-web (TFPHTTPClient), synapse, lnet, indy, benibela
internet tools, etc.
Can you specify the code? I looked at synapse or inet, but I'm
newcomer in such networking things.
----------------------------------------------------------------------
BeniBela · 2013-01-04 23:30
Quote from: Aeternitas on January 04, 2013, 07:18:20 pmCan you specify
the code? I looked at synapse or inet, but I'm newcomer in such
networking things.
See
And my Internet Tools actually have an auto update class.
But it is very old, written before I thought about making it a
library, so it has a few issues: the version number must be an
integer, all error messages are in German (perhaps I should translate
them?), sometimes the download just stops and it cannot automatically
install the update anymore. (used to work great, when I run it on
Windows 98, but all those recent OSs have so many protective
permissions for their application directories...)
Still, you an check for an update with it (if you put a xml file with
the version number on your web site), and download it (if you have
another ), like this:
Code: [Select]updater:=TAutoUpdater.create(yourCurrentVersionNumber,Ex
tractFilePath(ParamStr(0)),'http://your.website.com/a.file.containing.
the.version.number.xml', 'http://your.website.com/a.file.containing.a.
changelog.with.download.urls.xml');
if updater.existsUpdate then begin
updater.downloadUpdate();
if updater.hasDirectoryWriteAccess then
updater.installUpdate(); //that should still
work, if your user has Windows 98
end;
The xml file for the version number looks like:
Code: [Select]
And the file with the download links:
Code: [Select]
----------------------------------------------------------------------
Chronos · 2013-01-05 13:38
You can look at this component/package for some inspiration:
http://svn.zdechov.net/PascalClassLibrary/UpdateChecker/
It use classic method of checking XML file on remote location a
comparing version or in this example release date. It can show change
log and allow download and run new setup program.
----------------------------------------------------------------------
Aeternitas · 2013-01-12 12:21
Thank you.
Finally I made it by Synapse and get function.