By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,573 Members | 1,887 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,573 IT Pros & Developers. It's quick & easy.

Application running

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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

Nov 20 '05 #2

P: n/a
"CJ Taylor" <no****@blowgoats.com> scripsit:
Hey I think this has been answered before, but what is the way to see if a
previous version of the application is running?


<http://www.google.de/groups?selm=blgrft%24c51nq%244%40ID-208219.news.uni-berlin.de>

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.