SET MULTILOCKS ON SET EXCLUSIVE OFF SET DELETED ON _Screen.Caption = "Project Safety" AppRun = IsAppRunning() IF !AppRun THEN _Screen.Visible = .F. DO FORM CURDIR() + "FORMS\Intro.SCX" SET CLASSLIB TO CURDIR() + "Library\MyTools" ADDITIVE oStandard = CREATEOBJECT('Standard') oStandard.Dock(0) READ EVENTS ELSE =MESSAGEBOX("Only one instance of this application can be run at a time.",64,"Project Safety") Quit ENDIF FUNCTION IsAppRunning LOCAL lnHWND, lcTitle, llRetVal *** Set UP API Calls Declare Integer FindWindow IN Win32Api String, String Declare BringWindowToTop IN Win32APi Integer Declare ShowWindow IN Win32Api Integer, Integer *** Get the current Screen Caption lcTitle = _Screen.Caption *** Change it to avoid finding THIS instance _Screen.Caption = SYS(3) *** Now locate another instance lnHWND = FindWindow( NULL, lcTitle ) *** And restore the original caption _Screen.Caption = lcTitle *** Check the results IF lnHWND > 0 *** We have found something! *** So make it uppermost and maximize it (ShowWin => 3) BringWindowToTop( lnHWND ) ShowWindow( lnHWND, 3 ) *** Set the Return Value llRetVal = .T. ENDIF *** Return Status for action RETURN llRetVal