473,472 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How can I test for previous instance of the application?


I am looking for the equivalent of this VB code:

If App.PrevInstance Then

End if
Thanks,

Helene (I am still learning about .NET)
Jul 21 '05 #1
3 1420
Helene Day <noSpam@noSpam> wrote:
I am looking for the equivalent of this VB code:

If App.PrevInstance Then

End if


I don't know for sure what that code does, but if you're trying to make
sure that there's only one instance of the application running, 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 #2
I got it...

Function PrevInstance() As Boolean

If
UBound(Diagnostics.Process.GetProcessesByName(Diag nostics.Process.GetCurrent
Process.ProcessName)) > 0 Then

Return True

Else

Return False

End If

End Function

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Helene Day <noSpam@noSpam> wrote:
I am looking for the equivalent of this VB code:

If App.PrevInstance Then

End if


I don't know for sure what that code does, but if you're trying to make
sure that there's only one instance of the application running, 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 #3
Helene Day <noSpam@noSpam> wrote:
I got it...

Function PrevInstance() As Boolean

If
UBound(Diagnostics.Process.GetProcessesByName(Diag nostics.Process.GetCurrent
Process.ProcessName)) > 0 Then

Return True

Else

Return False

End If

End Function


Well, that will tell you if there's another process with the same name.
It's always possible that there will be a completely *different*
process with the same name, of course. The chances of that kind of
clash happening are much lower with a named mutex, however.

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

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

Similar topics

25
by: Treetop | last post by:
I have seen some codes that can test for the browser and give values accordingly. I tried to read the FAQ, but was unable to find a simple version of this. What I want is If Netscape-test {...
12
by: Jan Roland Eriksson | last post by:
I have worked some more on this suggested new mFAQ version trying to get all user input to blend into the text. Another review by the NG would be welcome. ===== Archive-name:...
2
by: Shabam | last post by:
I'm getting the following 2 errors randomly when doing a load test on a web application's search engine. As far as I know, there isn't writing to the DB involved when doing searches, so I'm at a...
3
by: Hubert Hermanutz | last post by:
Hi, is it possible with C#/.NET looking after previous instances of application, or rather to check if previous instance is always running? Thanks in advance, Hubert
0
by: ricky | last post by:
I found the code below on how to check for a previous instance of an app, but I don't think this will work for a network executeable. So, how do you check to see if there is multiple instances of...
3
by: Helene Day | last post by:
I am looking for the equivalent of this VB code: If App.PrevInstance Then End if Thanks, Helene (I am still learning about .NET)
6
by: Ben Finney | last post by:
Howdy all, Summary: I'm looking for idioms in unit tests for factoring out repetitive iteration over test data. I explain my current practice, and why it's unsatisfactory. When following...
27
by: Josh | last post by:
We have a program written in VB6 (over 100,000 lines of code and 230 UI screens) that we want to get out of VB and into a better language. The program is over 10 years old and has already been...
176
by: nw | last post by:
Hi, I previously asked for suggestions on teaching testing in C++. Based on some of the replies I received I decided that best way to proceed would be to teach the students how they might write...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.