473,322 Members | 1,405 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,322 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 1335
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.