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 the specified screen buffer to be the currently displayed console screen buffer.
BOOL WINAPI SetConsoleActiveScreenBuffer( _In_ HANDLE hConsoleOutput );
A handle to the console screen buffer.
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.
A console can have multiple screen buffers. SetConsoleActiveScreenBuffer determines which one is displayed. You can write to an inactive screen buffer and then use SetConsoleActiveScreenBuffer to display the buffer's contents.
This API is not recommended but it does have an approximate virtual terminal equivalent in the alternate screen buffer sequence. Setting the alternate screen buffer can provide an application with a separate, isolated space for drawing over the course of its session runtime while preserving the content that was displayed by the application's invoker. This maintains that drawing information for simple restoration on process exit.
For an example, see Reading and Writing Blocks of Characters and Attributes.
|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)|