[Lazarus] Shell notifications

Antonio Fortuny a.fortuny at sitasoftware.lu
Tue Aug 20 16:09:50 CEST 2013


Le 20/08/2013 15:46, Henry Vermaak a écrit :
> On Tue, Aug 20, 2013 at 03:21:01PM +0200, Antonio Fortuny wrote:
>> Le 20/08/2013 14:56, Henry Vermaak a écrit :
>>> On Tue, Aug 20, 2013 at 02:22:02PM +0200, Antonio Fortuny wrote:
>>>> Hi Folks.
>>>>
>>>> Do you know any component / tool to allow an application to be
>>>> notified by the host OS when something changes in a disk directory ?
>>>> Both Windows & Linux.
>>> inotify on linux (together with select()).  I'm told
>> Couldn'f find any inotify.* unit into my FPC/Lazarus installation
>> Only an inotify.h
> It's in the linux unit, since inotify is linux specific.
>
>>> FindFirstChangeNotification() is the thing to use on Windows, but I've
>>> never tried.
>> I did and it runs OK as it is part of the kernel32.dll. But I'll
>> have to run into a loop as this shell function is not event driven.
>> I'll maybe make a wrapper onto it using a separated thread.
> You can use a wait function (e.g. WaitForMultipleObjects) with the
> handle that FindFirstChangeNotification() returns.  So start a thread,
> get the handle, use wait function and call an event when the wait
> function indicated that something happened with the handle.  Repeat.
This was in my mind too.
>
> You'll have to do something similar for the linux implementation: start
> a thread, get inotify fd, add that to fpselect(), call some event
> when fpselect() indicates that the fd is readable. Repeat.
I'll try a little bit later.

Thanks,

Antonio.

>
> Henry

-- 
Sita Software
*Antonio Fortuny*
Senior Software engineer

220, avenue de la Liberté
L-4602 Niederkorn
Tel.: +352 58 00 93 - 93
www.sitasoftware.lu <http://www.sitasoftware.lu>
Your IT Partner

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130820/a66cad69/attachment-0003.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cffbecif.jpg
Type: image/jpeg
Size: 2306 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130820/a66cad69/attachment-0006.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ciidbjii.jpg
Type: image/jpeg
Size: 921 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130820/a66cad69/attachment-0007.jpg>


More information about the Lazarus mailing list