以前的答案,你自己看看是否可以?
来自:pegasus 时间:1999-9-5 13:03:33 ID:131311
使用文件系统变化通知,只要:
Uses Windows;
Var
myHandle: HANDLE;
Begin
myHandle := FindFirstChangeNotification(
'A:/',
FILE_NOTIFY_CHANGE_FILE_NAME or FILE_NOTIFY_CHANGE_DIR_NAME
or FILE_NOTIFY_CHANGE_ATTRIBUTES OR FILE_NOTIFY_CHANGE_SIZE
OR FILE_NOTIFY_CHANGE_LAST_WRITE
);
IF (myHandle<>INVALID_HANDLE_VALUE)
then
Begin
Repeat
WaitForSingleObject(myHandle);
// if there's any change happens under 'A:/';
// the following codes will be executed:
Refresh your dir?
FindNextChangeNotification(myHandle);
Until (do not want to detect changes again);
FindCloseChangeNotification(myHandle);
End;
End;