SetConsoleScreenBufferInfoEx function


This document describes console platform functionality that is no longer a part of our ecosystem roadmap. We do not recommend using this content in new products, but we will continue to support existing usages for the indefinite future. Our preferred modern solution focuses on virtual terminal sequences for maximum compatibility in cross-platform scenarios. You can find more information about this design decision in our classic console vs. virtual terminal document.

Sets extended information about the specified console screen buffer.


BOOL WINAPI SetConsoleScreenBufferInfoEx(
  _In_ HANDLE                        hConsoleOutput,
  _In_ PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx


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

lpConsoleScreenBufferInfoEx [in]
A CONSOLE_SCREEN_BUFFER_INFOEX structure that contains the console screen buffer information.

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.



This API has a partial virtual terminal equivalent. Cursor positioning buffer and text attributes have specific sequence equivalents. The color table is not configurable, but extended colors are available beyond what is normally available through console functions. Popup attributes have no equivalent as popup menus are the responsibility of the command-line client application in the virtual terminal world. Finally, the size of the window and the full screen status are considered privileges owned by the user in the virtual terminal world and have no equivalent sequence.


Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Header ConsoleApi2.h (via WinCon.h, include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See also

Console Functions