如何在Visual C++ 6.0中实现C++语言的输出字体颜色和背景的改变?
1个回答
展开全部
参考
void printString(const wchar_t* cs) {
if (cs == NULL) {
return;
}
WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), cs, wcslen(cs), 0, NULL);
}
void printErrorString(const wchar_t* cs) {
HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h, FOREGROUND_RED | FOREGROUND_INTENSITY);
printString(cs);
SetConsoleTextAttribute(h,
FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
}
//也就是几个win32函数
SetConsoleTextAttribute
WriteConsoleW
等
void printString(const wchar_t* cs) {
if (cs == NULL) {
return;
}
WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), cs, wcslen(cs), 0, NULL);
}
void printErrorString(const wchar_t* cs) {
HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h, FOREGROUND_RED | FOREGROUND_INTENSITY);
printString(cs);
SetConsoleTextAttribute(h,
FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
}
//也就是几个win32函数
SetConsoleTextAttribute
WriteConsoleW
等
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询