|
-
Apr 23rd, 2001, 06:02 PM
#1
Thread Starter
New Member
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
-
Apr 23rd, 2001, 08:28 PM
#2
PowerPoster
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;
}
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
-
Apr 23rd, 2001, 10:26 PM
#3
Thread Starter
New Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|