Solved

Hide the command prompt for a command line program

Posted on 2004-10-11
4
322 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
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 goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

627 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