*** When passed a string (i.e., 'Microsoft Word'), return .T. *** if the application is running. LPARAMETERS luApplication LOCAL luRetVal, lnFoxHwnd, lnWindow, lnWhich, lcText, lnLen, lnRes LOCAL ARRAY laJunk[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 *** 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 ) ) *** If the function was passed an Application Name, check for a match IF lnLen > 0 IF UPPER( ALLTRIM( luApplication ) ) $ UPPER( ALLTRIM( lcText ) ) RETURN .T. ENDIF ENDIF ENDIF *** See if there is another running application lnWindow = GetWindow( lnWindow, 2 ) ENDDO *** we haven't found a match for the passed application name RETURN .F.