to locate the previous instance of an application
-
I have an exe say xyz.exe. Whn i click on that exe for the second time i need to re-invoke the previous instance of that application again.Could anyone help me out on finding the previous instance of an application????? URagav Everything can be sacrificed for truth, but truth cannot be sacrificed for anything .
-
I have an exe say xyz.exe. Whn i click on that exe for the second time i need to re-invoke the previous instance of that application again.Could anyone help me out on finding the previous instance of an application????? URagav Everything can be sacrificed for truth, but truth cannot be sacrificed for anything .
http://www.codeproject.com/threads/singleinstancemfc.asp[^] http://www.codeproject.com/threads/singleinstance.asp[^] http://www.codeproject.com/cpp/csingleinst.asp[^] and lot more. Sonork 100.41263:Anthony_Yio
-
I have an exe say xyz.exe. Whn i click on that exe for the second time i need to re-invoke the previous instance of that application again.Could anyone help me out on finding the previous instance of an application????? URagav Everything can be sacrificed for truth, but truth cannot be sacrificed for anything .
hi, under the WIN32API we have CreateMutex function... u can use this function to check whether the appilcation is already running.. by its return values u can re-invoke the existing one...
Public Declare Function CreateMutex Lib "kernel32" Alias "CreateMutexA" (lpMutexAttributes As SECURITY_ATTRIBUTES, ByVal bInitialOwner As Long, ByVal lpName As String) As Long
this is the declaration for that function.(from API text viewer) u can also find help in MSDN abt this. http://support.microsoft.com/default.aspx?scid=kb;en-us;258088[^] use this link... heres a vb sample....Option Explicit Const ERROR_ALREADY_EXISTS = 183 Public Declare Function CreateMutex Lib "Coredll" Alias "CreateMutexW" _ (lpMutexAttributes As Long, _ ByVal bInitialOwner As Long, _ ByVal lpName As String) As Long Public Declare Function GetLastError Lib "Coredll" () As Long Private Sub Form_Load() Dim error_code CreateMutex CLng(0), 1, App.Title If GetLastError() = ERROR_ALREADY_EXISTS Then MsgBox "Already running", vbOKOnly, App.Title App.End Else 'run the application MsgBox "OK to run" End If End Sub
all the best.. - thanks and regards, Basavaraj P.Umadi