. . *-- APPID is set at .H File..values is like 'myProj2003-03' IF isAppRun(APPID) MESSAGEBOX(APP_ALREADY_RUNNING_LOC,48, ; 'my application cation' ) RETURN ENDIF . . goApp=CreateObject('myProj') . . FUNCTION isAppRun(tcUniqueID) LOCAL llRetVal, lcUniqueID lcUniqueID = STRTRAN( tcUniqueID, " " ) *** First check for the existence of the Semaphore window IF WEXIST("_Semaphore_") RETURN .T. ENDIF *** Look for an occurrence of this ID as a Window Name DECLARE INTEGER FindWindow IN Win32Api AS FindApp String, String IF FindApp( NULL, lcUniqueID ) > 0 *** We found one! Set Return Value llRetVal = .T. ELSE *** Create a new window with this ID DEFINE WINDOW _Semaphore_ IN DESKTOP ; FROM 1,1 TO 2,2 ; TITLE lcUniqueID ENDIF RETURN llRetVal ENDFUNCRGDS