DECLARE INTEGER GetForegroundWindow IN Win32API * Assuming an MDI application with VFP 7.0 lnactive = GetForegroundWindow() IF _VFP.hwnd = lnactive * vfp is active ELSE * it isn't ENDIFWith previous versions of VFP, you'd use the Foxtools Mainhwnd() function. For an SDI applicaton in 7.0 you'd use the active form's hwnd property. In VFP 6.0 and before you'd use _WFindTitl() and _Whtohwnd() passing the active form's caption. Both of these are in Foxtools.