Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top