LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Run On app Instance but using file from second instance ?

HiAll

 

 

Some info.

I wrote a program which runs from a shortcut with attributes, each shortcut contains different attributes.

How can i run only one instance of this program but when i open a the program with a different shortcut(while the inital program is open) the one program instance must user this shortcut attributes?

 

Thanks

Shako

Help share your knowlegde
0 Kudos
Message 1 of 3
(3,281 Views)

Hi Shako,

CVI has CheckForDuplicateAppInstance () function that prmits you to know if another instance of the app is already running. You can use it as a way to prevent multiple instances of your app to be running. To be detected, other instances of the application must already have called the function, as explained in the online help.

 

With reference to launch parameters, they are normally recevied in argv [] parameter of the main (), in which the forst parameter is always the program name, while other parameters are listedin the following elements of the array. argc parameter stores the number of command line parameters the progra was caled with.

 

To debug this option you can use Run >> Command line... menu option, which allows you to input every additional parameter you want so that it's easy for you to debug program activity in every case.

Message Edited by Roberto Bozzolo on 04-19-2010 02:44 PM


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 3
(3,259 Views)

I understand that CheckForDuplicateAppInstanc() is used to let you know if another instance wants to start so that you can stop it.

I am currently using argv and argc and it is working brilliantly.

 

But my problem is how do i get the value (argv,argc) from the second instance to be used in my currently opened instance.

Or how do i close the current instance to make the second instance the only one open ?

 

An Example is any media player, when you double click on an mp3 it opens the media player, while the media player is open and you double click on another mp3 the media

player changers what its playing to your last select mp3 with out opening another instance of the media player.

 

How do i do that ?

Help share your knowlegde
0 Kudos
Message 3 of 3
(3,253 Views)