LPARAMETERS lcWindowName,lcSimpleAppName ** check to see if app is already open DECLARE INTEGER FindWindow IN Win32API STRING lpClassName, STRING lpWindowName DECLARE INTEGER IsIconic IN Win32api INTEGER DECLARE ShowWindow IN Win32api INTEGER,INTEGER DECLARE SetForegroundWindow IN Win32api INTEGER nWinHandle = FindWindow(.NULL., lcWindowName) *Returns 0 if it can't find "YourApp" as a window title, *otherwise it returns a handle > 0 IF nWinHandle <> 0 llFound=.T. MESSAGEBOX('A current session of '+ALLTRIM(lcSimpleAppName)+' is already in use.'+CHR(13)+CHR(10)+; 'Only one session of '+ALLTRIM(lcSimpleAppName)+' can be used at a time.',0+64+0,_screen.Caption) IF IsIconic(nWinHandle) = 1 ShowWindow(nWinHandle,4) ENDIF *Wait Wind "App is already running."+ CHR(13) + ; * "Switching to establish session." Timeout 2 SetForegroundWindow(nWinHandle) QUIT ENDIF