Thread: Hiding the console.

  1. #1
    0x01
    Join Date
    Sep 2001
    Posts
    88

    Hiding the console.

    ...
    Is there a way to hide the win32 console window?
    (Ex. When the program opens, the console doesn't show up but still runs in the background.)

  2. #2
    Registered User Daniel's Avatar
    Join Date
    Jan 2003
    Posts
    47
    If you want to hide it while it performs a particular task you could
    do something like this example:

    Code:
    int main(int argc, char* argv[]) 
    { 
            static const char szTitle[] = "Generate a GUID Here"; 
    
    
            ::SetConsoleTitle( szTitle ); 
    
    
            Sleep( 2000 ); 
    
    
            HWND hWnd = NULL; 
            while (NULL == hWnd) 
            { 
                    hWnd = ::FindWindow( NULL, szTitle ); 
            } 
    
    
            ShowWindow( hWnd, SW_HIDE ); 
            Sleep( 2000); 
            ShowWindow( hWnd, SW_SHOWNA ); 
            Sleep( 2000 ); 
    
    
            return 0; 
    }

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Or maybe create/compiler it as a GUI app instead of a console based one.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  4. #4
    Confused
    Join Date
    Nov 2002
    Location
    Warwick, UK
    Posts
    209
    Could you please explain what you are doing in that code ? I'm not familiar with handles...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Hiding The Console...
    By David Somekh in forum C++ Programming
    Replies: 2
    Last Post: 06-24-2007, 01:32 PM
  2. Hiding the Console
    By Rare177 in forum C Programming
    Replies: 4
    Last Post: 06-09-2004, 12:34 PM
  3. Hiding the Console Cursor
    By XSquared in forum C Programming
    Replies: 1
    Last Post: 08-29-2003, 12:52 AM
  4. Hiding the console - extended
    By Korhedron in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2003, 02:59 PM
  5. Hiding the console window?
    By XenoCodex Admin in forum C++ Programming
    Replies: 6
    Last Post: 06-23-2002, 04:08 PM