12-17-2018 04:04 AM
Hello,
I would like to know if it is possible to run a GUI developed using CVI from a command line.
My need would be to open a command window to enter the name of my program followed by an argument.
Example: "C:\MyApp.exe MyArgument"
Thanks in advance for your response.
Solved! Go to Solution.
12-17-2018 04:22 AM
This is definitely possible: a CVI program can be launched from the command line; if any parameter is added, the program will receive them in argv[ ] argument of the main function, while argc argument counts the number of parameters received.
Note: argv[0] always holds the program name and argc equals 1 if no parameters are added to the command line.
12-17-2018 04:41 AM
Thank you Rif.
I know the use of arguments. There was not my problem.
But I have just found that check the option "Create console application" in target settings. And it works.
But now, when I launch my application from Windows Explorer without going through the command line, a command window opens anyway.
Is it possible to avoid this?
PS: I use CVI 9.0
12-17-2018 06:27 AM - edited 12-17-2018 06:28 AM
I suppose it's not possible: as you can read in the help (highlight is mine)
If you enable this option, LabWindows/CVI creates your executable as a console application. Console applications create a Windows console window (Command Prompt window) and set the standard I/O port to the console. Create a console application if you want to redirect the standard input or output of your program.
Nevertheless, creating a console application is quite different from "launching a GUI from a command line": what is your exact goal? Can yo add some details more?
12-17-2018 10:36 AM
As mentioned, a colleague asks me to be able to launch the application in two ways:
- or using a command line with an argument. In this case, it works well.
- from Windows Explorer and so without a command window being displayed.
The application has not been structured for this, so I can not change it deeply. I think I'll leave as it is now. Thank you for trying to help me.