LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to launch a GUI from a command line ?

Solved!
Go to solution

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.

Didier
0 Kudos
Message 1 of 5
(2,837 Views)

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.



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?
0 Kudos
Message 2 of 5
(2,828 Views)

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

Didier
0 Kudos
Message 3 of 5
(2,824 Views)

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?



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 4 of 5
(2,813 Views)
Solution
Accepted by topic author DidierR

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.

 

Didier
0 Kudos
Message 5 of 5
(2,802 Views)