Application running

  • Thread starter Thread starter CJ Taylor
  • Start date Start date
C

CJ Taylor

Hey I think this has been answered before, but what is the way to see if a
previous version of the application is running?

Thanks,
CJ
 
Hi CJ,

|| Hey I think this has been answered before, but
|| what is the way to see if a previous version of the
|| application is running?

Sure has. Time and again. :-)

The following works for me. It relies on the caption of the main form.
Herfried has suggested using a Mutex which will work in the case that a
different app has the same title, or for apps that have a changeable title, or
none. I haven't tried it yet (it's on the todo).

Regards,
Fergus

'===================================================================
Public Shared Function tThereIsAnInstanceOfThisProgramAlreadyRunning _
(Optional tToActivateThePrevInstance As Boolean = False, _
Optional ProgramTitle As String = "?") As Boolean
Dim sProcessName As String
Dim aoProcList() As System.Diagnostics.Process

sProcessName = GetCurrentProcess.ProcessName
aoProcList = GetProcessesByName (sProcessName) 'At least 1.

If aoProcList.Length = 1 Then
'There's just me.
Return False
End If

If tToActivateThePrevInstance Then
ActivateMyBetterHalf (ProgramTitle)
End If

'Another me beat me to it.
Return True
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

application tester 16
Installer chat today. 1
Crystal Issue 3
Computer Crashing 8
AI Tech Support - BETA feature 8
Anchor Property 4
OT: What up Peeps? 3
StackOverFlowException 3

Back
Top