[Lazarus] Shell notifications

Antonio Fortuny a.fortuny at sitasoftware.lu
Thu Aug 22 15:22:13 CEST 2013


Le 22/08/2013 14:06, Henry Vermaak a écrit :
> On Thu, Aug 22, 2013 at 01:49:28PM +0200, Sven Barth wrote:
>> Am 22.08.2013 13:33, schrieb Antonio Fortuny:
>>> See the code in attachment
>>>
>>> I changed the code a little bit adding the OVERLAP parameter and
>>> events to use the async method.
>>> Now the same function returns error code 6
>> Error code 6 is ERROR_INVALID_HANDLE (would be nice if you'd mention
>> the error message as well next time when you're already using
>> SysErrorMessage). FindFirstChangeNotification returns a notification
>> handle, but ReadDirectoryChanges requires a directory handle (with
>> FILE_LIST_DIRECTORY priviledge), so you need to open the directory
>> yourself.
> To add to this, the remarks section on msdn says this:
>
> "To obtain a handle to a directory, use the CreateFile function with the
> FILE_FLAG_BACKUP_SEMANTICS flag."
>
> In addition to this you're also passing an OVERLAPPED record to
> ReadDirectoryChangesW(), so you'll have to use FILE_FLAG_OVERLAPPED when
> you open the directory, too.
This did it. Don't even need FindFirstChangeNotification
Thanks

Antonio.
>
> Henry
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>







More information about the Lazarus mailing list