Kernel32GetConsoleTitle Method

Retrieves the title for the current console window.

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, BestFitMapping = false, 
	ThrowOnUnmappableChar = true, SetLastError = true)]
public static uint GetConsoleTitle(
	StringBuilder buffer,
	uint bufferSize
)

Parameters

buffer  StringBuilder
A pointer to a buffer that receives a null-terminated string containing the title.

If the buffer is too small to store the title, the function stores as many characters of the title as will fit in the buffer, ending with a null terminator.

bufferSize  UInt32
The size of the buffer pointed to by the buffer parameter, in characters.

Return Value

UInt32
If the function succeeds, the return value is the length of the console window's title, in characters.

If the function fails, the return value is zero and GetLastError returns the error code.

Remarks

See Also