PC Review


Reply
Thread Tools Rate Thread

Application running

 
 
CJ Taylor
Guest
Posts: n/a
 
      6th Oct 2003
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


 
Reply With Quote
 
 
 
 
Fergus Cooney
Guest
Posts: n/a
 
      6th Oct 2003
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



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      6th Oct 2003
"CJ Taylor" <(E-Mail Removed)> 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>
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing Messages from One Running Application to a Second Running Wiz66006@nospam.nospam Microsoft Dot NET 1 23rd Feb 2008 10:49 PM
Subject: Deploy application to remote sites vs Running application using RD David Microsoft VB .NET 0 21st Jan 2007 10:11 PM
Application requires the installation of sql.wce4.armv4.cab for it to run properly. install the Cab file before running this application ayrookuzhy Microsoft Dot NET Compact Framework 1 30th Jan 2006 07:38 PM
DDE application hang when there is another .NET window form application is running at the same time Joshua Chan Microsoft Dot NET Framework Forms 1 11th Jan 2005 04:27 PM
How to close an application when a button is clicked even when the application is running another process? Anderson Takemitsu Kubota Microsoft Dot NET Compact Framework 2 19th Aug 2003 12:47 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:09 PM.