Invisible wrote:
> I wonder... Is there some function call in the Win32 API that can
> actually change the colour of the text in a console window? Or is that
> impossible? Does anybody here know the Win32 API well enough to know the
> answer?
Yes, there is:
#include "stdio.h"
#include "windows.h"
void main()
{
HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hCon, 0x0C);
printf("Hello in red");
SetConsoleTextAttribute(hCon, 0x09);
printf(" and in blue\n");
getchar();
}
Detailed here:
http://msdn.microsoft.com/en-us/library/ms686047.aspx
Post a reply to this message
|