Create Class MyPjxHook as ProjectHook of MyPjxHookThen Modify the QueryModifyFile, and add this code.
LPARAMETERS oFile, cClassName IF TYPE("_OpenFiles")#"C" PUBLIC ARRAY _OpenFiles[1,3] PUBLIC _CloseFileTimer _CloseFileTimer = NEWOBJECT( "phTimer", THIS.CLASSLIBRARY ) ELSE PUBLIC ARRAY _OpenFiles( ALEN(_OpenFiles,1)+1,3 ) ENDIF _OpenFiles( ALEN(_OpenFiles,1),1 ) = JUSTFNAME(oFile.NAME)+IIF(NOT EMPTY(JUSTFNAME(cClassName))," ("+JUSTFNAME(cClassName)+")", JUSTFNAME(cClassName)) _OpenFiles( ALEN(_OpenFiles,1),2 ) = TRANSFORM(FDATE( oFile.NAME ))+" "+FTIME( oFile.NAME ) _OpenFiles( ALEN(_OpenFiles,1),3 ) = FULLPATH(oFile.NAME) RETURNThe LPARAMETER statement is already provided, and does not need to be added again.
RELEASE _OpenFiles RELEASE _CloseFileTimerClose this class
Create Class phTimer as Timer of MyPjxHookIn the Timer event place
private i, f f=.f. FOR i=1 TO ALEN(_OpenFiles,1) DO case CASE EMPTY( _OpenFiles(i,1) ) CASE EMPTY( _OpenFiles(i,2) ) CASE EMPTY( _OpenFiles(i,3) ) CASE NOT WEXIST( _OpenFiles(i,1) ) this.FileClosed( i ) CASE NOT WEXIST( "Class Designer - "+_OpenFiles(i,1) ) this.FileClosed( i ) CASE NOT WEXIST( "Form Designer - "+_OpenFiles(i,1) ) this.FileClosed( i ) CASE NOT WEXIST( "Report Designer - "+_OpenFiles(i,1) ) this.FileClosed( i ) CASE NOT WEXIST( "Label Designer - "+_OpenFiles(i,1) ) this.FileClosed( i ) CASE NOT WEXIST( "Menu Designer - "+_OpenFiles(i,1) ) this.FileClosed( i ) ENDCASE NEXT IF f f = ALEN(_OpenFiles,1) FOR i=ALEN(_OpenFiles,1) TO 1 STEP -1 IF EMPTY(_OpenFiles(i,1)) =ADEL(_OpenFiles,i) f=f-1 ENDIF NEXT DIMENSION _OpenFiles(MAX(1,f),3) ENDIF RETURNCreate a new method from the File menu / New Property called FileClosed. Edit the new method and add this code.
LPARAMETERS i LOCAL cFile, lchg cFile = _OpenFiles(i,3) lchg = .F. lchg = lchg or (FILE(cFile) AND TRANSFORM(FDATE( cFile ))+" "+FTIME( cFile ) > _OpenFiles(i,2)) lchg = lchg or (FILE(STUFF(cFile,LEN(cFile),1,"t")) and TRANSFORM(FDATE( STUFF(cFile,LEN(cFile),1,"t") ))+" "+FTIME( STUFF(cFile,LEN(cFile),1,"t") ) > _OpenFiles(i,2) ) IF lchg STRTOFILE("The file'" + _OpenFiles(i,1) + "'" + ; " modified at " + TRANSFORM(FDATE( cFile ))+" "+FTIME( cFile ) + ; " by "+TRANSFORM(SYS(0))+ ; CHR(13)+chr(10), "Pjx.log",.t.) _OpenFiles(i,1) = "" f=.t. ENDIF RETURNClose this class too.