LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Console Application starting an optinal GUI

Solved!
Go to solution

Hi everyone,

I have a single aplication running a GUI OR  a console interface. The CVI GUI is used in normal cases by the majority of the users.

If the main function gets invoked with a special command line parameter the program starts as console application. Otherwise the GUI is used.

If I use the "command line" setting for the projekt the console interface is working as expected but in the GUI mode I always have a black empty console window in the background.

If I use the "application project" setting the GUI is working es expected but the command line interface is always running in a seperate window.

At the moment I'm using the application project setting because the CMD line interface is less important. When I invoke my project I'm using a Windows pipe to forward the ouput of the child process window back to the parent command line window using:

myProgram.exe | MORE

This is not working without problems with dynamic changing command line output buffers because the pipe is flushing at line ends. Thats why I'm looking for another way. 

  • Is there a way to decide wether to start a application or console application at runtime? I guess not...
  • Is there a way to hide the console window when compiled as console application but starting the CVI GUI.
  • Is there a another way to archive my aim?

 

Many Thanks,

Jonny

 

 

0 Kudos
Message 1 of 3
(3,838 Views)

Hi Jonny,

 

the easiest way (saving time and effort) would be to compile two separate executables.

This is whow most applications work that offer both: gui and cmd interface.

 

Best,

Peter

0 Kudos
Message 2 of 3
(3,751 Views)
Solution
Accepted by topic author Broky

Hi Peter,

thank you for your response. Of cause I can solve the problem the way you described but that's a work around and no real solution if you ask me. 

Today I found a nother way using the windows SDK. 

#include <windows.h>

 

AttachConsole(ATTACH_PARENT_PROCESS);

 

Everythink is working as expected now.

 

Jonny

 

Message 3 of 3
(3,741 Views)