473,395 Members | 1,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

detect 2nd instance

Hi
can anyone point me in the right direction of detecting if an application is
running so that if a 2nd instance is started it can check and self
terminate?

Thanks

Doug
Jul 21 '05 #1
4 1340
Hi Doug,

If Process.GetProcessesByName
(Process.GetCurrentProcess.ProcessName).Length > 1 Then
MessageBox.Show("Another Instance of this process is already running")
Application.Exit()
End If

Vijrag.
"Doug Bell" wrote:
Hi
can anyone point me in the right direction of detecting if an application is
running so that if a 2nd instance is started it can check and self
terminate?

Thanks

Doug

Jul 21 '05 #2
Doug Bell wrote:
Hi
can anyone point me in the right direction of detecting if an
application is running so that if a 2nd instance is started it can
check and self terminate?


There's a nice solution for this in Chris Sells' book Windows Form
Porgramming in {C#|VN.NET}. You can get the code from his web site at
http://www.sellsbrothers.com/writing/wfbook/.

Cheers,

--
Joerg Jooss
jo*********@gmx.net
Jul 21 '05 #3
Doug
Jul 21 '05 #4
Doug Bell <dug@bigpond> wrote:
can anyone point me in the right direction of detecting if an application is
running so that if a 2nd instance is started it can check and self
terminate?


See http://www.pobox.com/~skeet/csharp/f...ation.instance

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: ch | last post by:
Hi, I am trying to write a VB program to detect the Dial Up Networking window in WinXP. For instance, everytime when i launch my Internet Explorer, the default MS windows Dial Up Networking will...
13
by: vega | last post by:
How do I detect empty tags if I have the DOM document? For example: <br /> and <br></br> I tried org.w3c.dom.Node.getFirstChild(), it returns null for both <br /> and <br></br> I also tried...
3
by: Szafranr | last post by:
Hi I have application where I used tcpListener to connect with another system. Every thing is ok that it's time to error handling and I have problem when the TCP client is disconect I don't...
5
by: TulasiKumar | last post by:
Hi all, I am new in Netwrok porgraming in cSharp.how can i detect Tcp/Ip packet in c#.Net.Any body knows please tell me, what are the interfaces or classes are supported regrading on TCP/IP...
7
by: Rob | last post by:
I do not want multiple instances of a vb.net program running concurrently... How may I detect this ? Thanks
2
by: José Joye | last post by:
Hello, I know, this question has been asked a lot of time.... It seems that it is not really possible to detect it within the code-behind. However, I would like to know if it is possible with...
5
by: YXQ | last post by:
How to detect programmatically if current user has the deleting permission to delete a Registry key in VS 2005? thank you very much!
3
by: manstey | last post by:
how do I detect a change in a list of class instances? from copy import deepcopy class CaListOfObj(list): """ subclass of list """ def __init__(self, *args, **kwargs): list.__init__(self,...
1
by: JamesB | last post by:
OK, after lots of faffing I have finally gotten remoting working - basically I have a windows service (the "server") and a forms app (the "client"). The forms app can call methods in the server,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.