08-23-2016 04:46 AM - edited 08-23-2016 04:59 AM
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.
Many Thanks,
Jonny
Solved! Go to Solution.
08-30-2016 05:01 AM
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
08-30-2016 11:58 AM
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