473,394 Members | 1,773 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,394 software developers and data experts.

One instance of exe is run one time in c#

Hi
There
I an c# windows application developer.
I create exe for my application.
when first click on exe it gives the Ist form
And next click on exe duplication instance were running.
How i am maintain single instance for application.,
Thanks in advance
Regards
N.Satish
Feb 2 '08 #1
3 2561
debasisdas
8,127 Expert 4TB
Question moved to .net forum from articles section.
Feb 4 '08 #2
wimpos
19
Hi
There
I an c# windows application developer.
I create exe for my application.
when first click on exe it gives the Ist form
And next click on exe duplication instance were running.
How i am maintain single instance for application.,
Thanks in advance
Regards
N.Satish
With the following code:
Expand|Select|Wrap|Line Numbers
  1. Process.GetProcessByName(your exe process name);
you can check if there is already an instance of your exe running. If it is, close the application again:
Expand|Select|Wrap|Line Numbers
  1. Application.Exit();
W.
Feb 4 '08 #3
Create one Mutex( initially set it if not set already)--> got for "Waitforsingleonject" --> with timeout value....if timeout then kill the process else enjoy............
Oct 13 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

18
by: John M. Gabriele | last post by:
I've done some C++ and Java in the past, and have recently learned a fair amount of Python. One thing I still really don't get though is the difference between class methods and instance methods. I...
2
by: Mike | last post by:
Greetings, Having a major problem here. running version 8.2 on win2003 server. The problem I am having is backing up a database seems to get to the last part of the backup and then fails. This...
6
by: Dmitry Karneyev | last post by:
Hi! I guess this question have been asked a lot of times, but please be tolerant and if you have any ideas share it. The question is: how to make availibale only one instance of application and...
5
by: Alexander Inochkin | last post by:
Hello. I have a working ASP.NET service. I am using .NET Framework 1.1; IIS V6.0. (web garden not used) When I change web.config file or load new *.dll, my service restarts, and about 90...
8
by: nytimescnn | last post by:
I've read some discuession about lock() for thread-safe. I am wondering what will be the differce between below two code segment? Code 1: class A { private static Object padlock = new...
3
by: Mark Jerde | last post by:
VS 2005. When I google "CSharp single instance form" the returned pages usually use a Mutex or the VB.NET runtime library....
12
by: titan nyquist | last post by:
I have a class with data and methods that use it. Everything is contained perfectly THE PROBLEM: A separate thread has to call a method in the current instantiation of this class. There is...
6
by: JB | last post by:
Hi All, I'm building a DLL that can be used by several applications. I'd like to have one single instance of a Class stored in my DLL that would be ("shared") by all the applications using that...
4
by: Dave | last post by:
I have a global.asax file with Application_Start defined and create some static data there and in another module used in the asp.net application and I realize that static data is shared amongst...
19
by: =?Utf-8?B?WWFua2VlIEltcGVyaWFsaXN0IERvZw==?= | last post by:
I'm doing my c# more and more like i used to code c++, meaning i'm casting more often than creating an instance of objects. like : protected void gvOrderDetailsRowDataBound(object sender,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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.