Solved

Hide the command prompt for a command line program

Posted on 2004-10-11
4
321 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
AVI wait icons for CAnimateCtrl in Visual Studio 2008 MFC 1 170
Dialogbox API leak? 18 118
Why isn't object file created? 6 107
draw a Christmas tree by using a nested loop? 26 105
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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

734 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