Thread: Hidden Console Program

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    17

    Hidden Console Program

    how do you make a console program that can only be seen under the processes window in the task manager?
    Drink Yer Wilk

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    As far as I know, all console programs open up a console window. If you don't want a console to pop up, get into windows programming.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    Here's a rather hackish solution....

    Code:
    #include <stdio.h>
    #include <windows.h>
    #include <conio.h>
    
    int main(void)
    {
    	
    	HWND hConsole = FindWindow(NULL, "title of my window");
    
    	ShowWindow(hConsole, SW_HIDE);
    
    	getch();
    
    	return 0;
    }
    //edit: Here's one that'll work no matter where your program is located (the title bar usually displays your program's location)

    Code:
    #include <stdio.h>
    #include <windows.h>
    #include <conio.h>
    
    int main(int argc, char *argv[])
    {
    	char tmp[50];
    
    	sprintf(tmp, "\"%s\"", argv[0]);
    
    	
    	HWND hConsole = FindWindow(NULL, tmp);
    	ShowWindow(hConsole, SW_HIDE);
    
            getch();
    
    	return 0;
    }
    Last edited by -KEN-; 03-10-2003 at 03:28 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. MSVC++2008 console program portability
    By CodeMonkey in forum Windows Programming
    Replies: 1
    Last Post: 11-18-2008, 03:13 AM
  2. Convert console sorting program to GUI?
    By Djanvk in forum C++ Programming
    Replies: 1
    Last Post: 09-19-2008, 05:48 PM
  3. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  4. hidden console
    By lithium in forum Windows Programming
    Replies: 1
    Last Post: 02-09-2003, 01:59 AM
  5. Replies: 2
    Last Post: 05-10-2002, 04:16 PM