c++ question
I''m relatively new to C++ and I had a question. In the command prompt is there a way to make it so everything remains static/in place instead of scrolling? Also I was wondering about coloring letters (I don''t know if it makes a difference but I have XP''s command prompt not reg DOS). I''m really more concerned with the scrolling issue though, thanks for your time.
Thanks! Anywhere I can find a good tut on it...? (Sorry about the newbie sounding garbabge but I''m unfortuneately in a bit of a ruch). Many thanks ahead of time.
Well I can help with coloring the text, but the scrolling is an issue I would have to do myself. Her goes with the coloring.
You need this line
#include < windows.h >
in that header file there is 2 things you need to use this:
HANDLE H_OUTPUT = GetStdHandle(STD_OUTPUT_HANDLE);
You need that to do colors. Then you make need to do this:
SetConsoleTextAttribute(H_OUTPUT, FOREGROUND_RED);
cout << "Hello World";
Now there is six color attributes they are:
FOREGROUND_RED
FOREGROUND_BLUE
FOREGROUND_GREEN
BACKGROUND_RED
BACKGROUND_BLUE
BACKGROUND_GREEN
The FOREGROUND colors affect the symbol, while the BACKGROUND colors affect behind the symbol.
Now you can do this:
SetConsoleTextAttribute(H_OUTPUT, FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND BLUE);
That will make orange lettering on blue.
The '|'s, I wont go into details, but if you want orange you have to mix up FOREGROUND_RED and FOREGROUND_GREEN. The '|' tells it to use that.
Try this:
I hope I helped
Jeff D
Suffered seven plagues, but refused to let the slaves go free. ~ Ross Atherton
Edited by - Jeff D on February 6, 2002 9:46:56 PM
You need this line
#include < windows.h >
in that header file there is 2 things you need to use this:
HANDLE H_OUTPUT = GetStdHandle(STD_OUTPUT_HANDLE);
You need that to do colors. Then you make need to do this:
SetConsoleTextAttribute(H_OUTPUT, FOREGROUND_RED);
cout << "Hello World";
Now there is six color attributes they are:
FOREGROUND_RED
FOREGROUND_BLUE
FOREGROUND_GREEN
BACKGROUND_RED
BACKGROUND_BLUE
BACKGROUND_GREEN
The FOREGROUND colors affect the symbol, while the BACKGROUND colors affect behind the symbol.
Now you can do this:
SetConsoleTextAttribute(H_OUTPUT, FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND BLUE);
That will make orange lettering on blue.
The '|'s, I wont go into details, but if you want orange you have to mix up FOREGROUND_RED and FOREGROUND_GREEN. The '|' tells it to use that.
Try this:
#include < windows.h >#include < iostream >using namespace std;int main(){ HANDLE H_OUTPUT = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(H_OUTPUT, FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE); cout << "Hello!";}
I hope I helped
Jeff D
Suffered seven plagues, but refused to let the slaves go free. ~ Ross Atherton
Edited by - Jeff D on February 6, 2002 9:46:56 PM
You''ll need to modify the console screen buffer if you''re trying to do some type of ascii art/game. Search for "console & screen buffer" in MSDN and you''ll find some console functions to help.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement