Kernel32ReadConsoleOutput Method

Reads character and color attribute data from a rectangular block of character cells in a console screen buffer, and the function writes the data to a rectangular block at a specified location in the destination buffer.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Kernel32.dll", SetLastError = true)]
public static bool ReadConsoleOutput(
	IntPtr consoleOutput,
	IntPtr buffer,
	ConsoleCoordinate bufferSize,
	ConsoleCoordinate bufferCoord,
	ref NativeRectangleSmall refReadRegion
)

Parameters

consoleOutput  IntPtr
A handle to the console screen buffer.

The handle must have the StandardRightsRead (GENERIC_READ) access right.

buffer  IntPtr
A pointer to a destination buffer that receives the data read from the console screen buffer.

This pointer is treated as the origin of a two-dimensional array of CharInfo structures whose size is specified by the bufferSize parameter.

bufferSize  ConsoleCoordinate
The size of the buffer parameter, in character cells.

The X member structure is the number of columns; the Y member is the number of rows.

bufferCoord  ConsoleCoordinate
The coordinates of the upper-left cell in the lpBuffer parameter that receives the data read from the console screen buffer.

The X member structure is the column; the Y member is the row.

refReadRegion  NativeRectangleSmall
A pointer to a NativeRectangleSmall structure.

On input, the structure members specify the upper-left and lower-right coordinates of the console screen buffer rectangle from which the function is to read.

On output, the structure members specify the actual rectangle that was used.

Return Value

Boolean
If the function succeeds, the return value is .

If the function fails, the return value is .

To get extended error information, call GetLastWin32Error.

Remarks

See Also