October 21st, 1999, 09:42 PM
I'm writing a console program and would like to display some of the characters (text) in yellow when in the DOS Prompt Box,
how do I code it ?
Thanks and regards.
how do I code it ?
Thanks and regards.
|
Click to See Complete Forum and Search --> : How to change the text color for a console app? October 21st, 1999, 09:42 PM I'm writing a console program and would like to display some of the characters (text) in yellow when in the DOS Prompt Box, how do I code it ? Thanks and regards. The Riviera Kid October 24th, 1999, 05:10 PM Hi, Use the API function SetConsoleTextAttribute. First, you need a handle to the screen buffer, if you are using standard I/O you can get this with a call to GetStdHandle: // Begin snippet HANDLE hScreen; hScreen = GetStdHandle (STD_OUTPUT_HANDLE); // Set the console text to green on a blue background SetConsoleTextAttribute (hScreen, FOREGROUND_GREEN | BACKGROUND_BLUE); // End Snippet The second paramater to SetConsoleTextAttribute specifies the colours and can be a combination of the following values: FOREGROUND_RED, FOREGROUND_GREEN, FOREGROUND_BLUE, FOREGROUND_INTENSITY, BACKGROUND_RED, BACKGROUND_GREEN, BACKGROUND_BLUE, and BACKGROUND_INTENSITY. Hope this helps. Darren. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |