How to hide command prompt using C language?

This is a discussion on How to hide command prompt using C language? within the C Programming forums, part of the General Programming Boards category; Hi all, I am a newbie in C. I want to ask how to hide command prompt window while the ...

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    4

    How to hide command prompt using C language?

    Hi all,
    I am a newbie in C.
    I want to ask how to hide command prompt window while the process still running?
    I want to do this in C programming

    What i have done now is calling another program using this code
    (void)System("anotherprogram.exe");

    However, command prompt window still appear.

    Anyone know how to hide the command prompt window?

    Thanks alot guys

    Regards,

    deob

  2. #2
    Registered User
    Join Date
    Mar 2009
    Posts
    4
    anyone can help me?

    thxz

  3. #3
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    Quote Originally Posted by deob View Post
    anyone can help me?

    thxz
    read about CreateProcess
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  4. #4
    Registered User
    Join Date
    Mar 2009
    Posts
    4
    I have read and learned about create process.
    But I still dont understand how to use the function?
    Could anyone give me an example?

  5. #5
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    http://tinyurl.com/coqcza

    edit: It's going to require use of Windows libraries, since that's not the kind of thing covered by standard C. You'll probably want to start lower than this if you have a lot of trouble understanding the examples.

  6. #6
    Registered User
    Join Date
    Mar 2009
    Posts
    4
    I have made createprocess() method and called anotherprogram.exe
    However, the command prompt window still appear

    As i know, createprocess method is used to run a new program. It creates a new process and its primary thread. Nevertheless, it does not hide the command prompt.

    Anyone could explain me and help me to find the solution?

    Anyhelp is kindly welcomed

    Thx

    deob

  7. #7
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    Well once you've forked the new process you'd end the current process, and that should exit the command window. This is of course assuming that the command window only appeared in the first place because you ran a console program. If you invoked the program from the command-line when it was already open, I don't believe the OS is going to let you close it programmatically.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why C Matters
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 136
    Last Post: 01-16-2008, 08:09 AM
  2. What language did they make Java in?
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 07-03-2005, 04:18 PM
  3. Strange loop
    By D@rk_force in forum C++ Programming
    Replies: 22
    Last Post: 12-18-2004, 01:40 PM
  4. Language of choice after C++
    By gandalf_bar in forum A Brief History of Cprogramming.com
    Replies: 47
    Last Post: 06-15-2004, 01:20 AM
  5. Language Script..
    By vasanth in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 03-30-2003, 05:48 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21