PRIVATE oMyTimer oMyTimer = CREATEOBJ('tmrShutdownIfNotVFP') oMyTimer.Interval = 500 && 1/2 second oMyTimer.Enabled = .T. * In another procedure... DEFINE CLASS tmrShutdownIfNotVFP AS TIMER Enabled = .F. Interval = 100 ProcessToWatch = 0 LastInForeground = NULL nvalue = 1 PROCEDURE Init DECLARE INTEGER GetCurrentProcessId IN WIN32API this.ProcessToWatch = BITOR(GetCurrentProcessId(),0) && cast integer ENDPROC PROCEDURE Timer LOCAL nThisProcessID, lForeground DECLARE INTEGER GetWindowThreadProcessId IN WIN32API ; INTEGER hWnd, ; INTEGER @ lpProcessID DECLARE INTEGER GetForegroundWindow IN WIN32API nThisProcessID = 0 =GetWindowThreadProcessID(GetForegroundWindow(),@nThisProcessID) lForeground = BITOR(nThisProcessID,0) # this.ProcessToWatch && cast integer IF this.LastInForeground # lForeground this.LastInForeground = lForeground IF lForeground * VFP Got focus ELSE * VFP Lost focus ENDIF ELSE this.nvalue = this.nvalue + 1 wait window " still in foreground" + alltrim(str(this.nvalue)) * No change in foreground status ENDIF ENDPROC ENDDEFINEWhen i run it and select any other application I still see that the value ticks even though vfp is in the background. What modifications should i have to do to use it??