How to do not pop up the command prompt?

This is a discussion on How to do not pop up the command prompt? within the C Programming forums, part of the General Programming Boards category; I'm just trying to simulate a combination of pressed keys, and I'd like the command prompt doesn't appear (it should ...

  1. #1
    ZaC
    ZaC is offline
    Lost in the C ZaC's Avatar
    Join Date
    Jun 2008
    Location
    Italy
    Posts
    47

    How to do not pop up the command prompt? (background program)

    I'm just trying to simulate a combination of pressed keys, and I'd like the command prompt doesn't appear (it should run in background), but how can I do this? I already serached for it on the forum and I got just this post which didn't help.
    Thanks in advance,
    ZaC.
    Last edited by ZaC; 06-28-2009 at 07:03 PM.
    Sorry for my bad English
    and also for my bad programming style...

    ZaC'ZaCoder (?!)

  2. #2
    Registered User Swarvy's Avatar
    Join Date
    Apr 2008
    Location
    United Kingdom
    Posts
    195
    One way of doing it would be to use the windows API. Basically you have to set up a really basic windows program, since you want it to run in the background, I would presume that any input/output of the program would be done either through command line or from/to a file. Either way, you can cope with that the same way you would for a command prompt program. I can't think of a way you can make a command prompt program run in the background, if I were you, I would use the windows api to do it.

    Disclaimer: I'm no expert, there may be a way of doing it using command prompt, but I don't know how if there is such a way.
    Last edited by Swarvy; 06-28-2009 at 08:03 PM.

  3. #3
    ZaC
    ZaC is offline
    Lost in the C ZaC's Avatar
    Join Date
    Jun 2008
    Location
    Italy
    Posts
    47
    Thanks, I'll look for windows api, because I nevere used it. Thanks again.
    Sorry for my bad English
    and also for my bad programming style...

    ZaC'ZaCoder (?!)

  4. #4
    Registered User
    Join Date
    Apr 2008
    Posts
    14
    If you are on windows:

    Code:
    #include <windows.h>
    
    int main(void) {
        HWND stealth;
        AllocConsole();
        stealth=FindWindowA("ConsoleWindowClass",NULL);
        ShowWindow(stealth,0);
    
        //Simulated Keystrokes
    
        return 0;
    }

  5. #5
    ZaC
    ZaC is offline
    Lost in the C ZaC's Avatar
    Join Date
    Jun 2008
    Location
    Italy
    Posts
    47
    Uhm, thanks, I tried it but nothing does change. The command prompt still pop up. Do I have to use some particular compiler?
    Sorry for my bad English
    and also for my bad programming style...

    ZaC'ZaCoder (?!)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. push n pop
    By salmansalman in forum C++ Programming
    Replies: 3
    Last Post: 05-27-2008, 10:41 AM
  2. Queues
    By ramayana in forum C Programming
    Replies: 22
    Last Post: 01-01-2006, 02:08 AM
  3. Stack using push and pop
    By silicon in forum C++ Programming
    Replies: 5
    Last Post: 11-03-2003, 04:54 PM
  4. pop up menu problem
    By bigtamscot in forum Windows Programming
    Replies: 5
    Last Post: 06-10-2003, 02:46 AM
  5. pop function
    By Troll_King in forum C Programming
    Replies: 12
    Last Post: 10-15-2001, 05:45 AM

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