$IFNDEF __FREEQ_LEAN
CONST FILE_NOTIFY_CHANGE_FLAGS_ALL = &H1 OR &H2 OR &H4 OR &H8 OR &H10 OR &H100
SUB SetFileChangeMonitor(TargetPath AS STRING , CheckSubDir AS INTEGER, Flags AS INTEGER)
IF Flags = 0 THEN Flags = FILE_NOTIFY_CHANGE_FLAGS_ALL
IF IDE.FileMonitorHook <> -1 THEN
ClearFileChangeMonitor
END IF
IDE.FileMonitorHook = FindFirstChangeNotification(TargetPath ,CheckSubDir ,Flags)
END SUB
FUNCTION CheckFileChangeMonitor () AS LONG
IF IDE.FileMonitorHook <> -1 THEN
IF (WaitForSingleObject(IDE.FileMonitorHook , 0) = 0) THEN
CheckFileChangeMonitor = True
ELSE
CheckFileChangeMonitor = False
END IF
END IF
END FUNCTION
SUB ClearFileChangeMonitor
IF NOT (IDE.FileMonitorHook = 0) THEN
FindCloseChangeNotification IDE.FileMonitorHook
IDE.FileMonitorHook = 0
END IF
END SUB
FUNCTION WaitFileChangeMonitor(TimeOut AS LONG) AS LONG
IF NOT (IDE.FileMonitorHook = 0) THEN
WaitFileChangeMonitor = WaitForSingleObject(IDE.FileMonitorHook , TimeOut)
END IF
END FUNCTION
$ENDIF
|