i know use SetConsoleTextAttribute():

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), ForgC|(BackC<<4) );

(too be honest: i don't have sure if i can avoid the '<<4')
i need ask these: can i add it more data and then use it?
like:
Blink=128

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), ForgC|(BackC<<4) | Blink);

and then test if these value is there?

Recommended Answers

All 5 Replies

The shift is not necessary, should be able to just or the forground and background colors together as you have done without the shift. As for your question, did you try it to see if it works?

thanks for correct me. i can try and test if theres an error. but then how can i test if the Blink is there?

i have tested now:

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN | BACKGROUND_BLUE | 2000 );

the backcolor isn't blue

The blue background works correctly in the code you posted here.

sorry... don't forget that i add '| 2000', that's why i don't recive the correct results.
so i can't use SetConsoleTextAttribute() for add extra data. but i did in a diferent way and works fine ;)
in time, i will share the Console class... you will love it ;)
thanks for all

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.