How about use Mutex of API? When you run the App, create "Test Mutex", and when quit the App, use ReleaseMutex function.
here is a sample...<PRE>Private Declare<FONT color=red>Function</FONT>CreateMutex Lib "kernel32" Alias "CreateMutexA" ( _<FONT color=red>ByRef</FONT> lpMutexAttributes<FONT color=red>As</FONT> Any, _<FONT color=red>ByVal</FONT> bInitialOwner<FONT color=red>As</FONT><FONT color=red> Long</FONT>, _<FONT color=red>ByVal</FONT> lpName<FONT color=red>As</FONT><FONT color=red> String</FONT>)<FONT color=red>As</FONT><FONT color=red> Long</FONT>
Private Declare<FONT color=red>Function</FONT>ReleaseMutex Lib "kernel32" ( _<FONT color=red>ByVal</FONT> hMutex<FONT color=red>As</FONT><FONT color=red> Long</FONT>)<FONT color=red>As</FONT><FONT color=red> Long</FONT>
Private Declare<FONT color=red>Function</FONT>OpenMutex Lib "kernel32" Alias "OpenMutexA" ( _<FONT color=red>ByVal</FONT> dwDesiredAccess<FONT color=red>As</FONT><FONT color=red> Long</FONT>, _<FONT color=red>ByVal</FONT> bInheritHandle<FONT color=red>As</FONT><FONT color=red> Long</FONT>, _<FONT color=red>ByVal</FONT> lpName<FONT color=red>As</FONT><FONT color=red> String</FONT>)<FONT color=red>As</FONT><FONT color=red> Long</FONT>
Private Declare<FONT color=red>Function</FONT>CloseHandle Lib "kernel32" ( _<FONT color=red>ByVal</FONT> hObject<FONT color=red>As</FONT><FONT color=red> Long</FONT>)<FONT color=red>As</FONT><FONT color=red> Long</FONT>
Private<FONT color=red>Const</FONT>ERROR_ALREADY_EXISTS = 183&
Private<FONT color=red>Const</FONT>MUTEX_ALL_ACCESS = &H1F0001
Private lngMutex<FONT color=red>As</FONT><FONT color=red> Long</FONT><FONT color=red>Sub</FONT>Aut

pen()
lngMutex = OpenMutex(MUTEX_ALL_ACCESS, 0, "Test Mutex")<FONT color=red>If</FONT>lngMutex = 0 Then
lngMutex = CreateMutex(<FONT color=red>ByVal</FONT> 0, 0, "Test Mutex")<FONT color=red>Else</FONT><FONT color=red>Call</FONT> CloseHandle(lngMutex)<FONT color=red>Call</FONT> MsgBox("The App is running already")<FONT color=red>End If</FONT><FONT color=red>End Sub</FONT><FONT color=red>Sub</FONT>Auto_Close()<FONT color=red>Call</FONT> ReleaseMutex(lngMutex)<FONT color=red>End Sub</FONT></PRE>
_________________
With Regards,
Colo
You can release your free soft ware on my site. Please email your file to me. Thanks.
This message was edited by Colo on 2002-08-25 23:14