Kernel32WriteConsoleOutput Method

Writes character and color attribute data to a specified rectangular block of character cells in a console screen buffer.

The data to be written is taken from a correspondingly sized rectangular block at a specified location in the source 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", CharSet = CharSet.Auto, SetLastError = true)]
public static bool WriteConsoleOutput(
	IntPtr consoleOutput,
	IntPtr buffer,
	ConsoleCoordinate bufferSize,
	ConsoleCoordinate bufferCoord,
	ref NativeRectangleSmall refWriteRegion
)

Parameters

consoleOutput  IntPtr
A handle to the console screen buffer.

The handle must have the StandardRightsWrite access right.

buffer  IntPtr
The data to be written to 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 pointed to by the buffer parameter, in character cells.

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

bufferCoord  ConsoleCoordinate
The coordinates of the upper-left cell in the buffer pointed to by the lpBuffer parameter.

The X member is the column, and the Y member is the row.

refWriteRegion  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 to write to.

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