Console Screen Buffers
A
screen buffer is a two-dimensional array of character and color data for output in a
console window. A console can have multiple screen buffers. The
active screen buffer is the one that is displayed on the screen.
The system creates a screen buffer whenever it creates a new console. A
process can use the
CreateConsoleScreenBuffer function to create additional screen buffers for its console. A new screen
buffer is not active until its handle is specified in a call to the
SetConsoleActiveScreenBuffer function. However, screen buffers can be accessed for reading and writing
whether they are active or inactive.
Each screen buffer has its own two-dimensional array of character information
records. The data for each character is stored in a
CHAR_INFO structure that specifies the Unicode or ANSI character and the foreground and
background colors in which that character is displayed.
A number of properties associated with a screen buffer can be set
independently for each screen buffer. This means that changing the active screen buffer can
have a dramatic effect on the appearance of the console window. The properties
associated with a screen buffer include:
- Screen buffer size, in character rows and columns.
- Text attributes (foreground and background colors for displaying text to be
written by the WriteFile or WriteConsole function).
- Window size and location (the rectangular region of the screen buffer that is
displayed in the console window).
- Cursor position, appearance, and visibility.
- Output modes (ENABLE_PROCESSED_OUTPUT and ENABLE_WRAP_AT_EOL_OUTPUT). For more
information about console output modes, see High-Level Console Modes.
When a screen buffer is created, it contains blanks. Its cursor is visible and
positioned at the buffer's origin (0,0), and the window is positioned with its
upper left corner at the buffer's origin. The size of the screen buffer, the
window size, the text attributes, and the appearance of the cursor are
determined by the user or by the system defaults. To retrieve the current values of the
various properties associated with the screen buffer, use the
GetConsoleScreenBufferInfo,
GetConsoleCursorInfo, and
GetConsoleMode functions.
Applications that change any of the screen buffer properties should either
create their own screen buffer or save the state of the inherited screen buffer
during startup and restore it at exit.
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database