Turn off std out?

Jul 15, 2011 at 7:05am
I'm wanting to write a program that syncs files between two different folders on my computer. What I'm planing to do is to use the System("batch command") function. Now you may ask why would I make a c++ program and not just a batch file. Well the answer is I want to be completely oblivious when said program runs. My worry is that if I use the all the system command a command window will pop up just like it currently does w/ my batch files. Is there anyway I can stop this?
Jul 15, 2011 at 7:35am
I can only speak for Windows. If you are in Linux/Mac/other, disregard my comment.

I say yes: Don't use sytem() and instead code everything in C++ in a GUI program (that shows no GUI).
Jul 15, 2011 at 8:02am
Ok maybe this is irrelevant, or maybe just my own problem. My experience with GUIs is VERY limited most of what I've done has been in java, and I definitely used netbeans very extensively I.e. made the gui with a gui generator, so If i were to take the gui option, is there any material that could get me started? Because just saying if I do that I might as well just go all the way and do it right.
Jul 15, 2011 at 8:13am
Qt is good?
Jul 15, 2011 at 11:34am
I don't know what IDE do you use but there should always be an option to create a project without console (like Win32 project with VC++). There the GUI would take place if you want it otherwise nothing will be seen.

EDIT: Yes QT is quite good
Last edited on Jul 15, 2011 at 11:34am
Jul 15, 2011 at 1:55pm
The CreateProcess() WinAPI function gives you the option of whether or not to display the new process's window... I don't think I've ever tried to do what you are doing though...

Hmm, come to think of it, I do think I have something useful that I snagged of the net some time ago though...

invis.vbs
1
2
3
4
5
6
7
8
'invis.vbs
'
' Use this script to execute a batch file invisibly (without the command
' window appearing):
'
'   wscript invis.vbs my.bat
'
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False 

Hope this helps.
Jul 15, 2011 at 3:50pm
Can I re-route cout to say a string stream?
Jul 15, 2011 at 4:02pm
If you use a VBScript, you can re-route output, but then you cannot hide the console window. Is either one or the other. :-S

To make a C++ app with no console, just create a Win32 executable with a WinMain() entry point that doesn't create any Windows. You can then use CreateProcess() to launch whatever and you can use named or anonymous pipes to re-route the output, error and input streams.
Jul 15, 2011 at 9:13pm
webJose +1
Topic archived. No new replies allowed.