473,750 Members | 2,520 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Single instance of windows form application

I have a windows form application developed in C++/CLR
How can I verify that only one instance of the application is running on the
user system at any given time.

Thanks

Nov 7 '08 #1
1 2517
>I have a windows form application developed in C++/CLR
>How can I verify that only one instance of the application is running on the
user system at any given time.
Have a look on MSDN for Knowledge Base article 243953 - "How to limit
32-bit applications to one instance in Visual C++". It uses
CreateMutex to create a unique named item. Also beware that if you
want to ensure a single instance per-machine in a TS environment, you
need to prefix the mutex name with "Global".

Dave
Nov 7 '08 #2

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

Similar topics

6
4669
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 if second one is loaded it must be close and give focus to first one. Thanks for any advice! Dmitry
20
6482
by: Michael A. Covington | last post by:
See: http://www.ai.uga.edu/mc/SingleInstance.html While attempting to use a mutex to allow only one instance of my app to run at a time (Recipe 4.12 in C# Programmer's Cookbook), I found that if the mutex is in a local variable in Main(), and my program launches any windows before Application.Run(), it will lose the mutex upon doing so. It shouldn't, as far as I can see. Moving the mutex variable outside Main() and making it static...
18
5659
by: Steve Barnett | last post by:
I want to ensure that there is only ever one instance of my app running on a single PC at any time. I understand that I can achieve this by using a mutex and, if I can't take ownership of the mutex, I know there is another instance of my program running. Problem is, how do I get the "new" instance to communicate with the "old" instance? The new one will have been started with a command line parameter that I want to pass to the old...
7
2157
by: jsale | last post by:
I have made an ASP.NET web application that connects to SQL Server, reading and writing data using classes. I was recommended to use session objects to store the data per user, because each user using the application needs to see their own data only. My problem is that when multiple users are in the application, when in the session object, data is fine, however as there is only one instance of the class files, when data is put into them,...
1
1414
by: Maileen | last post by:
Hi, How can i do (and test) a single instance of my form ? thanks, Maileen
9
5111
by: MrSpock | last post by:
1. Create a new Windows Application project. 2. Open the project properties and check "Make single instance application". 3. Build. 4. Go to the release folder and run the application. 5. Try to open a second instance of the application. This will cause an unhandled exception and the "Send Error Report" box shows up. Does this happen to anyone else, or is it just me? Debug info: "Unhandled exception at 0x00e149fd in...
3
8839
by: Tom Rogers | last post by:
How do I make it so that once my application (.exe) is running, if the user tries to run a second instance of the program, it is not allowed. I want my program to be able to have only one instance of it running, period. Thx, -Tom
3
7195
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. http://en.csharp-online.net/Application_Architecture_in_Windows_Forms_2.0%E2%80%94Single-Instance_Detection_and_Management http://www.codeproject.com/csharp/SingleInstanceApplication.asp http://blogs.msdn.com/onoj/archive/2004/06/04/148532.aspx "Program.cs" below seems to work fine. A feature is it restores a...
10
1451
by: Peter Morris | last post by:
Some time ago I needed to write a single-instance app. That's an easy task but I also needed duplicate instances to pass their command line parameters to the first instance so that it can act upon them. I ended up achieving this using Remoting to start my first app, and then call into that Singleton remoted object from secondary instances. I thought I was pretty clever until today when I tried to show an OpenFileDialog and received an...
0
9000
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8838
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9577
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...
1
9339
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6804
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
6081
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();...
1
3322
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
2804
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2225
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.