|
发表于 2013-3-1 18:47:46
|
显示全部楼层
需要用到两个系统的API
1. GetStdHandle- .DLL命令 GetStdHandle, 整数型, "kernel32", "GetStdHandle", 返回标准I/O句柄
- .参数 nStdHandle, 整数型, ,
复制代码 2. SetConsoleTextAttribute- .DLL命令 SetConsoleTextAttribute, 整数型, "kernel32", "SetConsoleTextAttribute", 设置屏幕文本属性
- .参数 hConsoleOutput, 整数型, ,
- .参数 wAttributes, 整数型, ,
复制代码 使用方法 先用hConsole = GetStdHandle(-11) 取得句柄
然后再用 SetConsoleTextAttribute(hConsole, Color) 来调整颜色
其中 Color 可以是以下几个整数的位或运算 数字位或就是颜色混合
8 高亮
4 红
2 绿
1 蓝 |
|