[Dev-C++] howto FindFirstChangeNotification
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <ca...@he...> - 2003-12-17 08:06:44
|
hi!
with the help of this list I found the windows function
Find(First|Next|Last)ChangeNotification.
I tried to build an example I found on the net using devcpp, but somehow
it fails..
it compiles just fine and runs smoothly without an error but unfortunately
without any effect either. it does not notice any change to any file
within the specified directory..
<code>
#include <windows.h>
#include <winbase.h> // I also tried winnt.h.. no difference
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
printf("I am currently waiting for a change..\n");
HANDLE chn = FindFirstChangeNotification("C:\\", FALSE,
FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_ATTRIBUTES |
FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_DIR_NAME);
while(1)
{
DWORD wr = WaitForSingleObject(chn, INFINITE);
DWORD dwMilSecs = 200;
do
{
FindNextChangeNotification(chn);
wr = WaitForSingleObject(chn, dwMilSecs);
}while(wr == WAIT_OBJECT_0);
}
printf("Now, there is one!\n");
FindCloseChangeNotification(chn);
system("PAUSE");
return 0;
}
</code>
any idea why this does not work?
thanks in advance!
---
Christian Schaefer
University of Applied Sciences Bremen Germany - Media Informatics
, , ,
<O <O <O
_( \_( \__( \_____This mail is written using pine via ssh.. ;-)
|