LOCAL loRetVal, lnFoxHwnd, lnWindow, lnWhich, lcText, lnLen, lnAppCnt, lnRes LOCAL ARRAY laJunk[1] loRetVal = CREATEOBJECT( [empty] ) ADDPROPERTY( loRetVal, "aApps[ 1 ]" ) ********************************************************** *** Check that the library has been set up and open it if not already done. ********************************************************** lnRes = ADLLS( laJunk ) IF lnRes = 0 OR NOT ( ASCAN( laJunk, 'GetWindow', 1, -1, 1, 15 ) > 0) DECLARE INTEGER GetWindow IN Win32Api ; INTEGER lnWindow, ; INTEGER lnWhich ENDIF IF lnRes = 0 OR NOT ( ASCAN( laJunk, 'GetWindowText', 1, -1, 1, 15 ) > 0) DECLARE INTEGER GetWindowText IN Win32Api ; INTEGER lnWindow, ; STRING @lcText, ; INTEGER lnLen ENDIF IF lnRes = 0 OR NOT ( ASCAN( laJunk, 'IsWindowVisible', 1, -1, 1, 15 ) > 0) DECLARE INTEGER IsWindowVisible IN Win32Api ; INTEGER lnWindow ENDIF lnAppCnt = 0 *** Loop through all the running applications *** Find the next window in the z-order lnWindow = GetWindow( _VFP.hWnd, 2 ) DO WHILE lnWindow # 0 *** Only deal with windows that are not owned windows *** (i.e, dialogs or messageboxes) and make sure the window is visible IF GetWindow( lnWindow, 4 ) = 0 AND IsWindowVisible( lnWindow ) # 0 lcText = SPACE( 254 ) lnLen = GetWindowText( lnWindow, @lcText, LEN( lcText ) ) *** Add this to the array IF lnLen > 0 lnAppCnt = lnAppCnt + 1 DIMENSION loRetVal.aApps[ lnAppCnt ] loRetVal.aApps[ lnAppCnt ] = LEFT( lcText, lnLen ) ENDIF ENDIF *** See if there is another running application lnWindow = GetWindow( lnWindow, 2 ) ENDDO RETURN loRetVal