hide console

This is a discussion on hide console within the C++ Programming forums, part of the General Programming Boards category; i have put a batch into my startup and my code runs when i startup windows, how do i hide ...

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

    hide console

    i have put a batch into my startup and my code runs when i startup windows, how do i hide the console when windows starts up? ie. .exe

  2. #2
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    Don't make a console project.

  3. #3
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    batch file isn't a console project!
    i suggest you to create a win project that runs other program, and after that quits...
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

  4. #4
    Registered User
    Join Date
    Mar 2006
    Posts
    17
    i created a win32 apllication project and when i tried to execute it nothing happened

  5. #5
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,262
    Well, I don't know if this is really what you wanted, but try putting this at the srart of your program:

    Code:
    char Title[256];
    int SizeTitle = sizeof( Title );
    GetConsoleTitle( Title, SizeTitle );
    HWND hWnd = NULL; 
    while ( NULL == hWnd ) 
    { 
        hWnd = FindWindow( NULL, Title ); 
    } 
    ShowWindow( hWnd, SW_HIDE);
    That's what I use to hide my programs. What you could do is create a function like so:


    Code:
    void	ShowConsole		( BOOL ShowHide )
    {
    	char Title[256];
    	int SizeTitle = sizeof( Title );
    
    	GetConsoleTitle( Title, SizeTitle );
    
    	HWND hWnd = NULL; 
    
    	while ( NULL == hWnd ) 
    	{ 
    		hWnd = FindWindow( NULL, Title ); 
    	} 
    
    	if		( ShowHide == FALSE )
    		ShowWindow( hWnd, SW_HIDE ); 
    
    	else if ( ShowHide == TRUE  )
    		ShowWindow( hWnd, SW_SHOW ); 
    }
    so throw in a 0 to hide the console, and a 1 to show it

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to hide output in a console
    By thelimpkid in forum C++ Programming
    Replies: 6
    Last Post: 09-02-2007, 08:50 AM
  2. Console App., Hide specific folder
    By nextstep in forum C++ Programming
    Replies: 10
    Last Post: 03-28-2005, 05:28 AM
  3. How to hide cursor in a Linux/Unix console?
    By Aidman in forum Linux Programming
    Replies: 2
    Last Post: 09-01-2004, 03:25 PM
  4. Console hide
    By geek@02 in forum Windows Programming
    Replies: 1
    Last Post: 06-17-2004, 05:45 AM
  5. how to hide the console program?
    By sqlin in forum C++ Programming
    Replies: 2
    Last Post: 04-28-2003, 08:32 PM

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