09-28-2011 09:16 PM
I want to prevent multiple instances of our Test Executives from running. Although I can use the /useExisting command line argument to force this behavior, I would like to be able to add something to the CVI code to force this flag.
Is there a way to modify the command line arguments from within main() once the application has started?
Or is there a way to configure ApplicationMgr to always follow the behavior of /useExisting?
Thanks,
Peter
09-29-2011 07:07 PM
Peter,
As I understand it, we are trying to prevent users from running multiple testexecs at one time, and not disable entry points from multiple "test uut" instances, correct?
I dont think there is built in functionality into the applicationmgr (because it is not running), but there are a few ways we could accomplish this. The very simple workaround is to simply make the shortcut to the program include the /useExisting flag. You could hide non-/useExisting references to the program if you did not want the users to find a way around it. The second method would be to use the windows API to check to see if an instance is running already, and based on that, close out the new instance. I think you may be able to find the exact functionality you need here: Process and Thread Functions from Microsoft
Let me know if that helps you out.
Regards,
Kyle Mozdzyn
Applications Engineering
National Instruments