LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I check for another application under CVI

Using labwindows/cvi 5.5, I need to check to see if another application is running, and if not, start it. The application is Procomm for windows, and if I just start it, it will connect to the incorrect serial port, so I need to check to see if it is already running.
0 Kudos
Message 1 of 5
(3,396 Views)
Hi...

There are a couple of ways you can do this, both involve using calls from the Windows SDK.

1. Search through a list of the active Windows for a title that matches what you want.

2. Obtain a list of the processes that are running and look for the name that you want.

I wouls suggest option 2, as this is the easiest.
Since you are after procom, you can start this yourself manually, then list the processes running and identify the name that you will search for.

If you don't have the Windows SDK, then you can go to the web and use the help from there.

If I seem to recall correctly, if you do a search on Processes you will find some example code that actually gets a list of active processes. (Hence option 2 being the easiest). All you need to to do
is modify the example code to look for your 'Procomm' process name and say return a BOOL indicating as such.

If this has confused you more then helped you, I'll try and search out the example code for you and email you direct or post it here.

Let me know how you get on,


Chris
0 Kudos
Message 2 of 5
(3,394 Views)
Hi,

There is a function in CVI called CheckForDuplicateAppInstance() that will do the job, you can even set it that shows the allready running app when you call it.

Hope this helps.

Regards,

Juan Carlos
N.I.
0 Kudos
Message 3 of 5
(3,394 Views)
Sorry for that I'm reviewing and I think I got it wrong, I'm guessing that you don't have access to the second application.

Another option for you is tou try to open the serial port, is you get the error code for the port being used by another app you can promt the user and only start the app when you are able to open the port.

I hope this helps better!!

let me know if you have other questions.

Juan Carlos
N.I.
0 Kudos
Message 4 of 5
(3,398 Views)
I realize that this thread is quite stale, however, I found a solution to a similar problem in the following thread:
How can I bring another application to Windows' foreground from CVI?
The user Sheetal recommended a product called AutoIT, which can be found at http://www.autoitscript.com/autoit3/downloads.php.
0 Kudos
Message 5 of 5
(3,250 Views)