Solved

Hide the command prompt for a command line program

Posted on 2004-10-11
4
317 Views
Last Modified: 2008-01-16
I am makign a Win32 command line program and was wondering how to make it just "run in the background" instead of show the command prompt. I figured out how to hide it once it started (using SetConsoleTitle, FindWindow, and ShowWindow) but then the program still shows for a breif time. Specfically, this program runs at login, if that makes any difference.
0
Comment
Question by:thaimin
  • 3
4 Comments
 
LVL 19

Expert Comment

by:mrwad99
Comment Utility
Are you using VC++ ?  If so you can change the linker (Project->Settings->Link tab) options to

subsystem:windows (instead of subsystem:console)

and add

/entry:mainCRTStartup

HTH
0
 
LVL 1

Author Comment

by:thaimin
Comment Utility
Okay, so that works, but leads to another problem. I call some other console apps with the system() command and when I do that, a console shows up (even though they produce no output). Is there a way to make these processes without showing up themselves (I tried CreateProcess() but that does the same thing...). Even when I use CreateProcess with a non-console app (such as notepad) but put it in the CommandLine field it still creates the console. Is there a way to not make this console show up? (also, does the first field on CreateProcess except arguments or just the program name?)

Thanks.
0
 
LVL 19

Expert Comment

by:mrwad99
Comment Utility
>> Even when I use CreateProcess with a non-console app (such as notepad) but put it in the CommandLine field it still creates the console. Is there a way to not make this console show up?

See http://www.experts-exchange.com/Programming/Programming_Platforms/Win_Prog/Q_10225450.htm (credit to jkr)

>> also, does the first field on CreateProcess except arguments or just the program name?)

According to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createprocess.asp, the second parameter is what you use to specify command line arguments.

HTH
0
 
LVL 19

Accepted Solution

by:
mrwad99 earned 100 total points
Comment Utility
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now