* At startup PUBLIC 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 PROCEDURE Init DECLARE INTEGER GetCurrentProcessId IN WIN32API this.ProcessToWatch = BITOR(GetCurrentProcessId(),0) && cast integer ENDPROC PROCEDURE Timer LOCAL nThisProcessID DECLARE INTEGER GetWindowThreadProcessId IN WIN32API ; INTEGER hWnd, ; INTEGER @ lpProcessID DECLARE INTEGER GetForegroundWindow IN WIN32API nThisProcessID = 0 =GetWindowThreadProcessID(GetForegroundWindow(),@nThisProcessID) IF BITOR(nThisProcessID,0) # this.ProcessToWatch && cast integer ? 'Die, VFP, die!' * We're out of all VFP Windows ENDIF ENDPROC ENDDEFINE