LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

how to ensure that only one instance of our application is running?

Hi,
 
I just want to ensure that if people click multiple times on my application only one instance runs in the end, any ideas we can use in Labwindows/CVI?
 
Even though they may all start finally I just want to keep only the first one alive & exit the subsequent runs, a classic problem, may be someone else has already explored all the options for doing this, so, a link to that message will also do.
 
Thanks,
Raj.
0 Kudos
Message 1 of 2
(2,896 Views)
There's an NI library call that can do this.  CheckForDuplicateAppInstance() in utility library.

Another way is to have the program try to create/grab exclusive access to a named mutex at start up.  If this fails, it means some other instance of the app has started and has created and grabbed the named mutex.  You just have to pick a name for the mutex that's unique to your app.  I wouldn't be surprised but that that's how the NI function is implemented.


Message 2 of 2
(2,894 Views)