BlueX

[C++]: SendColoredText

Aug 2nd, 2012
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <Windows.h>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. void SendColoredText(string str,int color);
  8.  
  9. int main(){
  10.  
  11.     SendColoredText("Checking file...",15),SendColoredText("[",15),SendColoredText("><",4),SendColoredText("]\n",15);
  12.     SendColoredText("Checking file...",15),SendColoredText("[",15),SendColoredText("\\/",2),SendColoredText("]\n",15);
  13.  
  14.     system("PAUSE");
  15.     return 0;
  16.  
  17. }
  18.  
  19. void SendColoredText(string str, int color){
  20.     HANDLE hConsole;
  21.  
  22.     hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
  23.     SetConsoleTextAttribute(hConsole, color);
  24.     cout << str;
  25.     SetConsoleTextAttribute(hConsole, 15);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment