T
Tanuki
Hi All:
I am currently writing a VC++ 6 program to detect file addition to a
specific directory. I am using ReadDirectoryChangesW to detect the
changes and I am running the detection mechanism as a working thread.
My code is as follows:
//*****************************
HANDLE hDir = CreateFile(directoryName, // pointer to the file name,
directoryName is a CString for the directory to be monitored
FILE_LIST_DIRECTORY, // access (read/write) mode
FILE_SHARE_READ|FILE_SHARE_DELETE, // share mode
NULL, // security descriptor
OPEN_EXISTING, // how to create
FILE_FLAG_BACKUP_SEMANTICS, // file attributes
NULL // file with attributes
to copy
);
FILE_NOTIFY_INFORMATION Buffer[1024];
DWORD BytesReturned;
while (ReadDirectoryChangesW (
hDir,&Buffer,1024,TRUE,FILE_NOTIFY_CHANGE_LAST_WRITE,&BytesReturned,NULL,NULL))
{
// do required tasks for file addition here
}
//************************
However, I kept having the compilation error of
error C2065 : 'ReadDirectoryChangesW' : undeclared identifier
Could someone please kindly enligten me on this? Thank you very much.
I am currently writing a VC++ 6 program to detect file addition to a
specific directory. I am using ReadDirectoryChangesW to detect the
changes and I am running the detection mechanism as a working thread.
My code is as follows:
//*****************************
HANDLE hDir = CreateFile(directoryName, // pointer to the file name,
directoryName is a CString for the directory to be monitored
FILE_LIST_DIRECTORY, // access (read/write) mode
FILE_SHARE_READ|FILE_SHARE_DELETE, // share mode
NULL, // security descriptor
OPEN_EXISTING, // how to create
FILE_FLAG_BACKUP_SEMANTICS, // file attributes
NULL // file with attributes
to copy
);
FILE_NOTIFY_INFORMATION Buffer[1024];
DWORD BytesReturned;
while (ReadDirectoryChangesW (
hDir,&Buffer,1024,TRUE,FILE_NOTIFY_CHANGE_LAST_WRITE,&BytesReturned,NULL,NULL))
{
// do required tasks for file addition here
}
//************************
However, I kept having the compilation error of
error C2065 : 'ReadDirectoryChangesW' : undeclared identifier
Could someone please kindly enligten me on this? Thank you very much.