'Watch a directory to detect filesize change
'Compiles in PB\CC and PB\DLL
------------------
'Compiles in PB\CC and PB\DLL
Code:
#COMPILE EXE #INCLUDE "win32api.inc" SUB DoEvents () STATIC MSG AS tagMSG IF PeekMessage (MSG, %NULL, 0,0, %PM_REMOVE) THEN TranslateMessage MSG DispatchMessage MSG END IF END SUB FUNCTION PBMAIN() AS LONG ON ERROR RESUME NEXT LOCAL lDir AS DWORD LOCAL lFound1 AS DWORD LOCAL lFound2 AS DWORD DO lDir = FindFirstChangeNotification("c:\", 0, %FILE_NOTIFY_CHANGE_SIZE) DO lFound1 = WaitForSingleObject(lDir, 100) CALL DoEvents LOOP WHILE lFound1 <> 0 DO #IF %DEF(%pb_dll32) MSGBOX "Change detected!" & TIME$ #ELSE STDOUT "Change detected! " & TIME$ #ENDIF lFound2 = FindNextChangeNotification(lDir) lFound2 = WaitForSingleObject(lDir, 100) EXIT DO LOOP lFound2 = FindCloseChangeNotification(lDir) CALL DoEvents LOOP END FUNCTION
------------------