I am trying to set text to Black and Black background, so it is invisible. Later I want to change it to white text color and all the text that was written becomes white.
I want to do that because of I have app using a lot of for loops and it is printing charcaters and I can see the characters printing slowly...
I want to avoid that I want to set text to be invisible and then when it does all of its job (writes all characters) then turn it into white color.
with that foreground text and background are set black
For others color, from MSDN:
An application can combine the foreground and background constants to achieve different colors. For example, the following combination results in bright cyan text on a blue background.
If no background constant is specified, the background is black, and if no foreground constant is specified, the text is black. For example, the following combination produces black text on a white background.
But what I want to achieve is to make text in whole console invisible AND later when I call function settextcolorVisible(); to make it visible
For example :
1 2 3 4 5 6 7
SetConsoleTextAttribute(m_Handle,0);
cout << "Bla bla bla"; // This text is invisible
SetConsoleTextAttribute(m_Handle, 15); // NOW THE TEXT("Bla bla bla") ABOVE GETS WHITE
return 0;
I am afraid you can't change the color of the text that is printed already.
If the printing takes too much time you can store the output in a string and print it when everything is finished.