Only one Exe at an instance
-
Hi! I've developed an application using Windows Forms Managed C++. I've deployed it and installed at client systems. At present I can run many instances of my application at the same time. But I want only one at any particular instancde(ie. if I click the desktop short cut for my app,when already an instance is running, another instance of my app should not run). How to do this?
-
Hi! I've developed an application using Windows Forms Managed C++. I've deployed it and installed at client systems. At present I can run many instances of my application at the same time. But I want only one at any particular instancde(ie. if I click the desktop short cut for my app,when already an instance is running, another instance of my app should not run). How to do this?
Have you searched[^] at all, you got the keywords right? BTW: a second instance will run shortly, discover it isn't the first, possibly pass on the command line, then exit. :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
-
Hi! I've developed an application using Windows Forms Managed C++. I've deployed it and installed at client systems. At present I can run many instances of my application at the same time. But I want only one at any particular instancde(ie. if I click the desktop short cut for my app,when already an instance is running, another instance of my app should not run). How to do this?
Technically speaking, you cannot prevent a second instance from coming up, but you can code your app in such a way that it detects if an instance is already running and pass on the command-line arguments and then exit. There are many approaches to this, one is to use a
Mutex
and the other is to use theSystem.Diagnostics.Process
class to check if the process is already running.