LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Function to launch an external application in CVI

Hi All,

I am getting started in Labwindows and what I am doing os trying to find a function in CVI to launch an external application (not .exe, .bat...). For example the encripted file to run a macro (ej. macro.ncx) in aspecific directory.

Thank's a lot for your help.
0 Kudos
Message 1 of 6
(7,240 Views)
To launch en external application you can use basically two methods: system () and LaunchExecutable () (or LaunchExecutableEx) functions. The first one waits for the launched program to terminate before returning control to your application, while the second returns immediately.

The problem can be the program launched: both commands accept only standard exe, com bat or pif programs, so to launch your specific file you'll have to find an alternative solution. One possible way is to launch the program that can execute the script passing it as a parameter (if possible) the same way as you will open for example a document with notepad:

LaunchExecutable ("notepad.exe c:\\mydocument.txt");


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 6
(7,233 Views)
One thing can help
See below :

GetProjectDir(PrjDir);
sprintf(HelpFile, "%s%s", PrjDir, "\\Help\\index.html");
Err = ShellExecute(NULL, "open", HelpFile, NULL, NULL, SW_SHOWNORMAL);

Here I wanted to launch Explorer (or the default web browser) in order to display an help file contained in one html file.
In this case I find usefull to use the Windows SDK ShellExecute function call.
You can do the same if you want your application play one mp3 file using the player. The player which will be used is the one that show up when you double click on one mp3 file name. Simply replace the html file path with the path to the mp3 file.
Regards, Philippe proud to be using LabWindows since version 1.2
// --------------------------------------------------------------------------------------------
0 Kudos
Message 3 of 6
(7,225 Views)
Thank's guys for your help.

The file I want to run is an executable but it is not an exe file. I have tried to run first the application and then open the executable file but it doesn`t work. I will follow triyng.

Cheers
0 Kudos
Message 4 of 6
(7,222 Views)
Did you try
int OpenDocumentInDefaultViewer (const char documentFilename[], int windowDisplay);

Regards,
Message 5 of 6
(7,194 Views)
We have found a possible solution as follows:


LaunchExecutable ("explorer.exe c:\\mydocument\......file to open");

Thank's a lot
0 Kudos
Message 6 of 6
(7,161 Views)