|
Overview |
|
|
|
Group |
|
|
|
Quick Info
Windows NT
| Yes
| Win95
| Yes
| Win32s
| No
| Import Library
| kernel32.lib
| Header File
| wincon.h
| Unicode
| No
| Platform Notes
| None
|
|
|
SetConsoleTextAttribute
The SetConsoleTextAttribute function sets the foreground (text) and background color attributes of
characters written to the screen buffer by the WriteFile or WriteConsole function, or echoed by the ReadFile or ReadConsole function. This function affects only text written after the function call.
BOOL SetConsoleTextAttribute(
HANDLE hConsoleOutput,
| // handle of console screen buffer
| WORD wAttributes
| // text and background colors
| );
|
|
Parameters
hConsoleOutput
Identifies a console screen buffer. The handle must have GENERIC_READ access.
wAttributes
Specifies the foreground and background color attributes. Any combination of
the following values can be specified: FOREGROUND_BLUE, FOREGROUND_GREEN,
FOREGROUND_RED, FOREGROUND_INTENSITY, BACKGROUND_BLUE, BACKGROUND_GREEN,
BACKGROUND_RED, and BACKGROUND_INTENSITY. For example, the following combination of values
produces white text on a black background:
FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error
information, call GetLastError.
Remarks
To determine the current color attributes of a screen buffer, call the GetConsoleScreenBufferInfo function.
See Also
GetConsoleScreenBufferInfo, ReadConsole, ReadFile, WriteConsole, WriteFile
Related Links
Software for Delphi and C++ Builder developers
Software for Visual Studio .NET developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET
TMS Scripter Studio Pro components for Delphi/C++Builder
More Online Helps
Win32 Multimedia Programmer's Reference (mmedia.hlp)
OLE Programmer's Reference (ole.hlp)
Microsoft Windows Pen API Programmer's Reference (penapi.hlp)
Microsoft Windows Sockets 2 Reference (sock2.hlp)
Microsoft Windows Telephony API (TAPI) Programmer's Reference (tapi.hlp)
Unix Manual Pages
|