Skip to content

Latest commit

 

History

History
123 lines (89 loc) · 6.19 KB

File metadata and controls

123 lines (89 loc) · 6.19 KB
title description author ms.author ms.topic keywords f1_keywords MSHAttr ms.assetid topic_type api_name api_location api_type
ScrollConsoleScreenBuffer function
See reference information about the ScrollConsoleScreenBuffer function, which moves a block of data in a screen buffer.
miniksa
miniksa
article
console, character mode applications, command line applications, terminal applications, console api
consoleapi2/ScrollConsoleScreenBuffer
wincon/ScrollConsoleScreenBuffer
ScrollConsoleScreenBuffer
consoleapi2/ScrollConsoleScreenBufferA
wincon/ScrollConsoleScreenBufferA
ScrollConsoleScreenBufferA
consoleapi2/ScrollConsoleScreenBufferW
wincon/ScrollConsoleScreenBufferW
ScrollConsoleScreenBufferW
PreferredSiteName:MSDN
PreferredLib:/library/windows/desktop
d78bf4c9-2314-466c-b617-619259c824b5
apiref
ScrollConsoleScreenBuffer
ScrollConsoleScreenBufferA
ScrollConsoleScreenBufferW
Kernel32.dll
API-MS-Win-Core-Console-l2-1-0.dll
KernelBase.dll
API-MS-Win-DownLevel-Kernel32-l1-1-0.dll
DllExport

ScrollConsoleScreenBuffer function

[!INCLUDE not-recommended-banner]

Moves a block of data in a screen buffer. The effects of the move can be limited by specifying a clipping rectangle, so the contents of the console screen buffer outside the clipping rectangle are unchanged.

Syntax

BOOL WINAPI ScrollConsoleScreenBuffer(
  _In_           HANDLE     hConsoleOutput,
  _In_     const SMALL_RECT *lpScrollRectangle,
  _In_opt_ const SMALL_RECT *lpClipRectangle,
  _In_           COORD      dwDestinationOrigin,
  _In_     const CHAR_INFO  *lpFill
);

Parameters

hConsoleOutput [in]
A handle to the console screen buffer. The handle must have the GENERIC_READ access right. For more information, see Console Buffer Security and Access Rights.

lpScrollRectangle [in]
A pointer to a SMALL_RECT structure whose members specify the upper-left and lower-right coordinates of the console screen buffer rectangle to be moved.

lpClipRectangle [in, optional]
A pointer to a SMALL_RECT structure whose members specify the upper-left and lower-right coordinates of the console screen buffer rectangle that is affected by the scrolling. This pointer can be NULL.

dwDestinationOrigin [in]
A COORD structure that specifies the upper-left corner of the new location of the lpScrollRectangle contents, in characters.

lpFill [in]
A pointer to a CHAR_INFO structure that specifies the character and color attributes to be used in filling the cells within the intersection of lpScrollRectangle and lpClipRectangle that were left empty as a result of the move.

Return value

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

ScrollConsoleScreenBuffer copies the contents of a rectangular region of a screen buffer, specified by the lpScrollRectangle parameter, to another area of the console screen buffer. The target rectangle has the same dimensions as the lpScrollRectangle rectangle with its upper-left corner at the coordinates specified by the dwDestinationOrigin parameter. Those parts of lpScrollRectangle that do not overlap with the target rectangle are filled in with the character and color attributes specified by the lpFill parameter.

The clipping rectangle applies to changes made in both the lpScrollRectangle rectangle and the target rectangle. For example, if the clipping rectangle does not include a region that would have been filled by the contents of lpFill, the original contents of the region are left unchanged.

If the scroll or target regions extend beyond the dimensions of the console screen buffer, they are clipped. For example, if lpScrollRectangle is the region contained by (0,0) and (19,19) and dwDestinationOrigin is (10,15), the target rectangle is the region contained by (10,15) and (29,34). However, if the console screen buffer is 50 characters wide and 30 characters high, the target rectangle is clipped to (10,15) and (29,29). Changes to the console screen buffer are also clipped according to lpClipRectangle, if the parameter specifies a SMALL_RECT structure. If the clipping rectangle is specified as (0,0) and (49,19), only the changes that occur in that region of the console screen buffer are made.

[!INCLUDE setting-codepage-mode-remarks]

Tip

This API is not recommended and does not have a virtual terminal equivalent. Use can be approximated with scroll margins to fix an area of the screen, cursor positioning to set the active position outside the region, and newlines to force text to move. The remaining space can be filled by moving the cursor, setting graphical attributes, and writing normal text.

Examples

For an example, see Scrolling a Screen Buffer's Contents.

Requirements

   
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Header ConsoleApi2.h (via WinCon.h, include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll
Unicode and ANSI names ScrollConsoleScreenBufferW (Unicode) and ScrollConsoleScreenBufferA (ANSI)

See also

CHAR_INFO

Console Functions

COORD

Scrolling the Screen Buffer

SetConsoleCP

SetConsoleOutputCP

SetConsoleWindowInfo

SMALL_RECT