Solved

Hide the command prompt for a command line program

Posted on 2004-10-11
4
318 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
ID: 12276479
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
ID: 12277204
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
ID: 12277879
>> 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
ID: 12277891
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

910 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

24 Experts available now in Live!

Get 1:1 Help Now