|
FILE_NOTIFY_CHANGE_LAST_WRITE = &10 ON CLOSE PROCcleanup : QUIT ON ERROR SYS "MessageBox", @hwnd%, REPORT$, 0, 0 : PROCcleanup : QUIT folder$ = "C:\Program Files" SYS "FindFirstChangeNotification", folder$, FALSE, \ \ FILE_NOTIFY_CHANGE_LAST_WRITE TO hNotify% IF hNotify% = -1 ERROR 100, "FindFirstChangeNotification failed" timeout% = 100 : REM 0.1 second REPEAT SYS "WaitForSingleObject", hNotify%, timeout% TO result% IF result% = 0 THEN PRINT "A file was changed" SYS "FindNextChangeNotification", hNotify% ENDIF REM Do something else if required UNTIL FALSE END DEF PROCcleanup hNotify% += 0 : IF hNotify% SYS "FindCloseChangeNotification", hNotify% ENDPROC