Windows API Translation
Andrej Mitrovic
andrej.mitrovich at gmail.com
Tue Feb 8 08:55:41 PST 2011
On 2/8/11, Andrew Wiley <debio264 at gmail.com> wrote:
> I'm trying to use the Windows file change notification API from D, and
> I'm having trouble translating Microsoft's macro-laden signatures into
> D. I thought I had it figured out, but optlink says otherwise:
> The original function is this:
That's odd, I was just going through its documentation yesterday
because I need it for a personal project. I've also looked at
ReadDirectoryChangesW, which should give me the exact file or folder
that was changed. Just in case you haven't found already (or if
someone else is interested), there's a few good pages describing these
functions:
FindFirstChangeNotification function:
http://msdn.microsoft.com/en-us/library/aa364417%28v=vs.85%29.aspx
Example C++ Code:
http://msdn.microsoft.com/en-us/library/aa365261%28v=vs.85%29.aspx
FindNextChangeNotification function:
http://msdn.microsoft.com/en-us/library/aa364427%28v=vs.85%29.aspx
ReadDirectoryChangesW function:
http://msdn.microsoft.com/en-us/library/aa365465%28v=vs.85%29.aspx
FILE_NOTIFY_INFORMATION Structure:
http://msdn.microsoft.com/en-us/library/aa364391%28v=vs.85%29.aspx
WaitForMultipleObjects Function:
http://msdn.microsoft.com/en-us/library/ms687025%28v=vs.85%29.aspx
http://stackoverflow.com/questions/342668/how-to-use-readdirectorychangesw-method-with-completion-routine
The C++ example of FindFirstChangeNotification works great. There's no
I/O polling going on, the thread is waiting for WaitForMultipleObjects
to return and get notifications from the OS for any file/folder
changes, and they're pretty much instantaneous.
More information about the Digitalmars-d
mailing list