473,749 Members | 2,660 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Running an application more than once

Any ideas how to stop the user opening an app more than once? So there is not
more than one instance running at the same time.

Thanks.
Feb 17 '06 #1
4 3471
James,

See my response in this thread for information on the
WindowsApplicat ionBase class, which you can use to do this:

http://groups.google.com/group/micro...2d86fcc6e071fe

There is also a solution there for .NET 1.1 and before as well.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"James L" <Ja****@discuss ions.microsoft. com> wrote in message
news:08******** *************** ***********@mic rosoft.com...
Any ideas how to stop the user opening an app more than once? So there is
not
more than one instance running at the same time.

Thanks.

Feb 17 '06 #2
You can also look at my article at
http://www.dalepreston.com/Blog/2005...-run-once.html for an
alternative method that will send any command line arguments on the second
instance to the first instance before shutting down the second instance.

There's one more good solution I'd like to suggest but I can't find it. It
is from a regular on the groups that has a site with a great Graphics
namespace help too. I can't find the site but if you can, his solution is
very simple if you don't need to do the message passing that my solution does.

HTH
--
Dale Preston
MCAD C#
MCSE, MCDBA
"James L" wrote:
Any ideas how to stop the user opening an app more than once? So there is not
more than one instance running at the same time.

Thanks.

Feb 17 '06 #3
"James L" <Ja****@discuss ions.microsoft. com> wrote in message
news:08******** *************** ***********@mic rosoft.com...
Any ideas how to stop the user opening an app more than once? So there is
not
more than one instance running at the same time.


In v1.x I used to do this with a Mutex object. I've not looked at how to do
this in v2 yet, but I believe your question has already been answered by
Nicholas and Dale.

Occasionally, just occasionally, I sometimes yearn for VB's simplicity...
App.PrevInstanc e was a classic, wasn't it...? :-)
Feb 18 '06 #4
Actually, I started using the Mutex method in VB apps years ago because
App.PreviousIns tance was not reliable. It was common for applications to be
able to be run twice because of timing issues.

My original inspiration for the Mutex method was an article on mvps.org
years ago that described more technical details of what caused the problems
when using App.PreviousIns tance. I don't remember that far back too clearly
and the site has changed formats so the old information isn't there anymore.

--
Dale Preston
MCAD C#
MCSE, MCDBA
"Mark Rae" wrote:
"James L" <Ja****@discuss ions.microsoft. com> wrote in message
news:08******** *************** ***********@mic rosoft.com...
Any ideas how to stop the user opening an app more than once? So there is
not
more than one instance running at the same time.


In v1.x I used to do this with a Mutex object. I've not looked at how to do
this in v2 yet, but I believe your question has already been answered by
Nicholas and Dale.

Occasionally, just occasionally, I sometimes yearn for VB's simplicity...
App.PrevInstanc e was a classic, wasn't it...? :-)

Feb 19 '06 #5

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

Similar topics

8
2687
by: nickdu | last post by:
I'm trying to isolate "applications" into their own application domain within a single process. I've quoted applications because it's a logical representation of an application. Basically it consists of a bunch of components supplied by some application group. I got this to work, somewhat. The problem is that the application performs roughly (and this has not been measured, but a guess based on the rendering of the application GUI) 10x...
16
2602
by: TB | last post by:
Hi all: If you think that the following comments are absolute amateurish, then please bear with me, or simply skip this thread. A couple of months back I made the decision to initiate a gradual upgrade of my web programming skills from Classic ASP / VBS to ASP.NET / VB.NET. While the study of the language differences and all the new features in .NET has so far not been a traumatic experience, I am a bit shell-schocked after
7
2578
by: MgGuigg | last post by:
Hello all, This is my first time posting a question to this forum, so here is hoping I am following protocol. I am scraping the rust off my old Basic programming skills, and have just recently upgraded to VB.NET, and I have a lot of catching up to do. That being said, I have come a long way in a short while, however, I am stumped at the moment. I have read through days of posts, but have not been able to address my specific question, so...
3
1799
by: Oenone | last post by:
In VB6, it's possible to create a project with a class library within it. The project can then be run with F5, and it sits and waits for an external process to create an instance of one of its objects. This is extremely useful, as it allows me (for example) to create a PlugIn class running in source, and call it from a host application that is running as an executable. In VB.NET, I'm not allowed to run class library projects, I simply...
0
1475
by: archana | last post by:
Hi all, I am having problem in one web method which i am running asynchronously I set oneway attribute in web method. What i want is once client called this web method this should start asynchronously. My client is windows application means after calling web method
4
4673
by: Jeremy S. | last post by:
We're in the process of writing a new Windows Forms app and the desktop support folks want for it to be run from a network share. I know it's possible (i.e., just have the framework on the clients and a desktop shortcut to the exe out on the network)... but is it really a good idea? What are some arguments for and against running a .NET Windows Forms client from a network share? Here is my initial list... I'd appreciate any additions,...
20
3056
by: Bradley | last post by:
Hey all, Another convert to vb.net here. My vb6 program was an application launcher that checked for previous instances of said programs and would alert the user with a message box. I can't, for the life of me, figure out how to do this in vb.net. Let's say notepad.exe (as an example) is already running. My program tries to launch it again, but I need to check if notepad.exe is already running before I launch it. Does anyone have a...
10
5777
by: sebastian nielsen | last post by:
If I have this code: Dim fs As New System.IO.FileStream("C:\application.exe", System.IO.FileMode.Open) Dim br As New System.IO.BinaryReader(fs) Dim data() as Byte data = br.ReadBytes(Convert.ToInt32(fs.Length)) br.close() fs.close() Now data() contains the whole EXE in binary format, and I want to run
4
1868
by: Propad | last post by:
Hello, I know this issue pops up once in a while, but I haven't found a good answer to it. I need to debug a long running application under windows. The application is a combined java/python framework for testing ECUs in the automotive industry. Basically, the Java GUI (Eclipse-based) starts test-cases written in Python and provides the console where the test-logs are seen. When there is a exception somewhere in the testcases (or the...
0
9568
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9389
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9256
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6801
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6079
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4709
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3320
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 we have to send another system
2
2794
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2218
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.