views:

171

answers:

2

I'm developing a application in Lazarus, that need to check if there is a new version of a XML file on every Form_Create.

How can I do this?

+1  A: 

You'll need to read up on FPC Networking, lNet looks especially useful for this task.

Kornel Kisielewicz
+2  A: 

I have used the synapse library in the past to do this kind of processing. Basically include httpsend in your uses clause, and then call httpgetbinary(url,xmlstream) to retrieve a stream containing the resource. I wouldn't do this in the OnCreate though, since it can take some time to pull the resource. Your better served by placing this in another thread that can make a synchronize call back to the form to enable updates, or set an application flag. This is similar to how the Chrome browser displays updates on the about page, a thread is launched when the form is displayed to check to see if there are updates, and when the thread completes it updates the GUI...this allows other tasks to occur (such as a small animation, or the ability for the user to close the dialog).

Synapse is not a visual component library, it is a library of blocking functions that wrap around most of the common internet protocols.

skamradt