Consider this function:
void ChangeConsoleColor(WORD wColor)
{
HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
if (h != INVALID_HANDLE_VALUE) {
SetConsoleTextAttribute(h, wColor);
CloseHandle(h);
}
}
"When I call this function, it works the first time,
but when I call it a second time,
GetStdHandle returns a handle
...