Recent

Author Topic: Check the new version of the program  (Read 6428 times)

Aeternitas

  • New Member
  • *
  • Posts: 42
    • The Dark Forests Web
Check the new version of the program
« on: January 04, 2013, 06:01:42 pm »
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

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Check the new version of the program
« Reply #1 on: January 04, 2013, 07:08:22 pm »
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

  • New Member
  • *
  • Posts: 42
    • The Dark Forests Web
Re: Check the new version of the program
« Reply #2 on: January 04, 2013, 07:18:20 pm »
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.

Can you specify the code? I looked at synapse or inet, but I'm newcomer in such networking things.

BeniBela

  • Hero Member
  • *****
  • Posts: 906
    • homepage
Re: Check the new version of the program
« Reply #3 on: January 05, 2013, 12:30:41 am »
Can 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,ExtractFilePath(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]
<versions>
  <stable value="1301"/>
</versions>

And the file with the download links:
Code: [Select]
<changelog program="...">
  <build version="1301" date="2012-12-24">
    <download url="http://your.website.com/update-window.exe" platform="WINDOWS" execute="&quot;$DOWNLOAD&quot; "/>
    <download url="http://your.website.com/update-linux64.deb" platform="LINUX64" execute=""/>
     <!-- ... -->
  </build>
</changelog>

Chronos

  • Full Member
  • ***
  • Posts: 241
    • PascalClassLibrary
Re: Check the new version of the program
« Reply #4 on: January 05, 2013, 02:38:46 pm »
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.
« Last Edit: December 21, 2018, 09:24:35 pm by Chronos »

Aeternitas

  • New Member
  • *
  • Posts: 42
    • The Dark Forests Web
Re: Check the new version of the program
« Reply #5 on: January 12, 2013, 01:21:57 pm »
Thank you.

Finally I made it by Synapse and get function.

 

TinyPortal © 2005-2018