title: How to use SetConsoleTextAttribute C++
body: <p>I have searched countless forums and websites but I can't seem to find the answer. I'm trying to use <em>SetConsoleTextAttribute</em> but it only affects the text. How can I affect the whole screen like the command <code>color 1f</code> would? My code is:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;windows.h&gt;
  #include &lt;wincon.h&gt;
  
  using namespace std;
  
  int main()
  {
      SetConsoleTitle("C++ CALCULATOR"); // Title of window
      int x; // Decision
      int a; // First Number
      int b; // Second Number
      int c; // Answer
      HANDLE Con;
      Con = GetStdHandle(STD_OUTPUT_HANDLE);
      SetConsoleTextAttribute(Con, BACKGROUND_BLUE | FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
      cout &lt;&lt; "CALCULATOR" &lt;&lt; endl &lt;&lt; endl;
      cout &lt;&lt; "1:ADDITION" &lt;&lt; endl &lt;&lt; "2:SUBTRACTION" &lt;&lt; endl &lt;&lt; "3:MULTIPLICATION";
      cout &lt;&lt; endl &lt;&lt; "4:DIVISION" &lt;&lt; endl &lt;&lt; "5:EXIT" &lt;&lt; endl;
      cin &gt;&gt; x;
      switch (x)
      {
          case 1: // Addition code
              cout &lt;&lt; endl &lt;&lt; "ADDITION" &lt;&lt; endl &lt;&lt; "FIRST NUMBER:";
              cin &gt;&gt; a;
              cout &lt;&lt; endl &lt;&lt; "SECOND NUMBER:";
              cin &gt;&gt; b;
              c = a + b;
              cout &lt;&lt; endl &lt;&lt; "ANSWER:" &lt;&lt; c;
              break;
          case 2: // Subtraction code
              cout &lt;&lt; endl &lt;&lt; "SUBTRACTION" &lt;&lt; endl &lt;&lt; "FIRST NUMBER:";
              cin &gt;&gt; a;
              cout &lt;&lt; endl &lt;&lt; "SECOND NUMBER:";
              cin &gt;&gt; b;
              c = a - b;
              cout &lt;&lt; endl &lt;&lt; "ANSWER:" &lt;&lt; c;
              break;
          case 3: // Multiplication code
              cout &lt;&lt; endl &lt;&lt; "MULTIPLICATION" &lt;&lt; endl &lt;&lt; "FIRST NUMBER:";
              cin &gt;&gt; a;
              cout &lt;&lt; endl &lt;&lt; "SECOND NUMBER:";
              cin &gt;&gt; b;
              c = a * b;
              cout &lt;&lt; endl &lt;&lt; "ANSWER:" &lt;&lt; c;
              break;
          case 4: // Division code
              cout &lt;&lt; endl &lt;&lt; "DIVISION" &lt;&lt; endl &lt;&lt; "FIRST NUMBER:";
              cin &gt;&gt; a;
              cout &lt;&lt; endl &lt;&lt; "SECOND NUMBER:";
              cin &gt;&gt; b;
              c = a / b;
              cout &lt;&lt; endl &lt;&lt; "ANSWER:" &lt;&lt; c;
              break;
          case 5: // Exit code
              return 0;
  
  
      }
  
  }
  </code></pre>