-
I've been trying to move my old C++ console app to VC++ and encountered a problem with conio.h. Well, previously, I used an older borland C++ compiler(3.xx) and conio.h contained a function to change the console text color and the console background color. The VC++ version does not. Is this something specific to Borlands version?
Also, is there some other library in VC++ that can do this? I searched the MSDN help files but couldn't find any.
Here's the example function that utilizes the borland version:
void SetColors(unsigned TxtColor, unsigned BkColor)
{
textcolor(TxtColor); textbackground(BkColor);
}
Thanks,
Paul
-
Try this out. It uses windows.h:
Code:
#include <windows.h>
int main(int argc, char* argv[])
{
HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h,FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | BACKGROUND_RED);
return 0;
}
-
Thanks alot!!! Almost works, I'm running W2K so it could be something specific to it. The problem is the entire background isn't painted with the specified color, only where text is printed. The rest of the console is black. I'll tinker with it some more tomorrow.
Thanks again,
Paul