title: C++ How do I hide a console window on startup?
body: <p>I want to know how to hide a console window when it starts.</p>
  
  <p>It's for a keylogger program, <strong>but</strong> it's not my intention to hack someone. It's for a little school project that I want to make to show the dangers about hackers.</p>
  
  <p>Here's my code so far:</p>
  
  <pre><code>#include &lt;cstdlib&gt;
  #include &lt;iostream&gt;
  #include &lt;Windows.h&gt;
  
  using namespace std;
  
  int main()
  {
  
      cout &lt;&lt; "Note. This program is only created to show the risk of being unaware of hackers." &lt;&lt; endl;
      cout &lt;&lt; "This program should never be used to actually hack someone." &lt;&lt; endl;
      cout &lt;&lt; "Therefore this program will never be avaiable to anyone, except me." &lt;&lt; endl;
  
      FreeConsole();
  
      system("PAUSE");
      return 0;
  }
  </code></pre>
  
  <p>I see the window appear and immediately disappear at startup. It seems to open a new console right after that, which is just blank. (By blank I mean "Press any key to continue.." I'm wondering if it has anything to do with <code>system("PAUSE")</code>) </p>
  
  <p>So I want to know why it opens a new console, instead of only creating and hiding the first one.</p>
  
  <p>Thanks. :)</p>