[Lazarus] Shell notifications
henry.vermaak at gmail.com
Tue Aug 20 15:46:57 CEST 2013
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.
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.
More information about the Lazarus