Windows API Translation

Andrew Wiley debio264 at gmail.com
Tue Feb 8 19:11:41 PST 2011


On Tue, Feb 8, 2011 at 7:16 PM, Andrej Mitrovic
<andrej.mitrovich at gmail.com> wrote:
> I don't know why I thought this would be easy. ReadDirectoryChangesW
> is a b**ch to use. Someone even wrote a wrapper for it:
> http://www.codeproject.com/KB/files/directorychangewatcher.aspx
>
> It clocks in at over 1500 lines. For a single API function. Yikes!
>
> Compare this to .Net's FileSystemWatcher. Create an object, pass a
> delegate, and get back some info: Console.WriteLine("File: {0} renamed
> to {1}", e.OldFullPath, e.FullPath);
> Your work is done.
>
> With ReadDirectoryChangesW I have to keep count of bytes to skip
> forward, use casts and keep separate pointers and length variables.
> Not to mention the function is not fully documented as this long blog
> post shows:
> http://qualapps.blogspot.com/2010/05/understanding-readdirectorychangesw.html
>

Honestly, API-wise, it feels a lot like most of the Posix C APIs (I'm
using iNotify on Linux for this already), but less polished. That bit
about missing events though, that's pretty crappy.
And I love how their docs imply that you can somehow use it with
FindFirstChangeNotification.
>From reading about the performance problems, it seems that the lovely
thin layer I built on iNotify on Linux might have to have to become a
multithreaded heavy backend on Windows. Ah well.


More information about the Digitalmars-d mailing list