This seems like a very cool API and seemingly straight-forward enough - just call CreateFile to get a handle on the directory you want to monitor, and call this API - it's then supposed to get back to you when an event occurs in that directory (basically the same as FindFileNotification, but better because it tells you WHAT changed). Unfortunately it's only supported on NT and Win2K, not Win9x.
Here's the reference for ReadDirectoryChangesW - http://msdn.microsoft.com/library/ps...lesio_97av.htm
There's also a very small and simple visual c++ demo at http://msdn.microsoft.com/library/de...hangeswapi.htm
Even I was able to compile it
but that's no good because I can't read C++ <grin> - it worked well though
Is there anybody kind enough that could help me translate these so as to call them from PB? It may even be possible to monitor C:\ and all subdirectories in the one API call, but as Im not good enough with PB yet as to be able to translate MSDN definitions to it, I'm a bit stuck
Here's the MSDN definitions:
Here's my PB translation:
It compiles fine, but I'm not sure if the translation is correct, and Ive got no idea how to call such a beast!
------------------
[This message has been edited by Wayne Diamond (edited April 09, 2001).]
Here's the reference for ReadDirectoryChangesW - http://msdn.microsoft.com/library/ps...lesio_97av.htm
There's also a very small and simple visual c++ demo at http://msdn.microsoft.com/library/de...hangeswapi.htm
Even I was able to compile it

Is there anybody kind enough that could help me translate these so as to call them from PB? It may even be possible to monitor C:\ and all subdirectories in the one API call, but as Im not good enough with PB yet as to be able to translate MSDN definitions to it, I'm a bit stuck

Here's the MSDN definitions:
Code:
BOOL ReadDirectoryChangesW( HANDLE hDirectory, // handle to directory LPVOID lpBuffer, // read results buffer DWORD nBufferLength, // length of buffer BOOL bWatchSubtree, // monitoring option DWORD dwNotifyFilter, // filter conditions LPDWORD lpBytesReturned, // bytes returned LPOVERLAPPED lpOverlapped, // overlapped buffer LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine // completion routine ); typedef struct _FILE_NOTIFY_INFORMATION { DWORD NextEntryOffset; DWORD Action; DWORD FileNameLength; WCHAR FileName[1]; } FILE_NOTIFY_INFORMATION, *PFILE_NOTIFY_INFORMATION;
Code:
TYPE FILE_NOTIFY_INFORMATION NextEntryOffset AS DWORD Action AS DWORD FileNameLength AS DWORD FileName AS STRING * 1 END TYPE DECLARE FUNCTION ReadDirectoryChangesW LIB "KERNEL32.DLL" ALIAS "ReadDirectoryChangesW" ( _ hDirectory AS LONG, _ lpBuffer AS FILE_NOTIFY_INFORMATION, _ nBufferLength AS DWORD, _ bWatchSubtree AS INTEGER, _ dwNotifyFilter AS DWORD, _ lpBytesReturned AS DWORD, _ xtmp1 AS DWORD, _ xtmp2 AS DWORD) AS LONG
------------------
[This message has been edited by Wayne Diamond (edited April 09, 2001).]