>* Entr >if IsAppRunning(Application.ServerName) && or any unique string you want - ie: MyNiceApplication >*... >endif > >Function IsAppRunning > Lparameters tcSemaphoreName > Local hsem, lpszSemName > #Define ERROR_ALREADY_EXISTS 183 > Declare Integer GetLastError In win32API > Declare Integer CreateSemaphore In WIN32API ; > string @ lpSemaphoreAttributes, ; > LONG lInitialCount, ; > LONG lMaximumCount, ; > string @ lpName > hsem = CreateSemaphore(0,0,1,tcSemaphoreName) > Return (hsem # 0 And GetLastError() == ERROR_ALREADY_EXISTS) >Cetin
IF hsem # 0 And GetLastError() == ERROR_ALREADY_EXISTS * samaphore => ProcessId => WHANDLE => SetForegroundWindow(WHANDLE) ENDIFI wan't use FindWindow because it is mistaken.