* Original AUTHOR: George Tasker * DATE: January 13, 1998 - 8:26 AM * PURPOSE: Determines if a Windows * application is running and returns * the handle of the window if it is, * otherwise returns 0. 32 bit version * for Windows 95/NT 3.51-4 * Note * Original version would not load the program * if you double clicked on it in explorer * because the explorer window might contain * part of the program window if the directory * and the program window were the same * (John Thornton) LPARAMETER pcTitle * Parameter list description * * pctitle - The title bar of the Window * Note: The title does not have to be * the complete title that appears * BUT IT MUST BE THE BEGINNING OF THE WINDOW NAME * API Declarations DECLARE INTEGER GetActiveWindow IN Win32API DECLARE INTEGER GetWindow IN Win32API; INTEGER hwnd, INTEGER dflag DECLARE INTEGER GetWindowText IN Win32API ; INTEGER hwnd, STRING @lptstr, INTEGER cbmax LOCAL lnhwnd, lnNext, llDone, lcTitleBar, ; lcSearchFor, lnTextLen lcSearchFor = UPPER(ALLTRIM(pctitle)) lnhwnd = GetActiveWindow() lnNext = 2 llDone = .F. lcTitleBar = "" DO WHILE NOT llDone IF NOT EMPTY(lnhwnd) lcTitleBar = SPACE(200) + CHR(0) lnTextLen = GetWindowText(lnhwnd, @lcTitleBar, 200) lcTitleBar = UPPER(LEFT(lcTitleBar, lnTextLen)) * Modified by John Thornton 2/16/00 * Changed so if you double click in explorer it will * still load the program if the dir has the same name IF lcTitleBar = lcSearchFor llDone = .T. ELSE lnhwnd = GetWindow(lnhwnd, lnNext) ENDIF ELSE llDone = .T. ENDIF ENDDO RETURN lnhwnd