Only one application instance
-
Hi, I would like to check if there is running any instance of my application, in order to set the focus on it if the user try to start a new one. Any idea? Thank you.
-
Hi, I would like to check if there is running any instance of my application, in order to set the focus on it if the user try to start a new one. Any idea? Thank you.
Something like this:
Int32 RunningProcesses = Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName ).Length;
if ( RunningProcesses >= 1 ) {
MessageBox.Show( "already running the program" );
}-- David Wengier Sonork ID: 100.14177 - Ch00k
-
Something like this:
Int32 RunningProcesses = Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName ).Length;
if ( RunningProcesses >= 1 ) {
MessageBox.Show( "already running the program" );
}-- David Wengier Sonork ID: 100.14177 - Ch00k
Just wanted to say thanks for posting this, because you probably saved me hours of trying to figure this out in C#! Thanks! Marc