Application: starting with Windows 10 v1809, Windows finally supports pseudo- consoles. If available, this offers a better solution than using the legacy console API.
If you really need to capture this message, use the console API .
CreateConsoleScreenBuffer and SetConsoleActiveScreenBuffer allow you to switch to a dedicated screen buffer so as not to interfere with the existing one.
SetConsoleScreenBufferSize can make the buffer wide enough to avoid SetConsoleScreenBufferSize strings.
SetConsoleCursorPosition can set the cursor position as required.
After you run the program, ReadConsoleOutput will allow you to read what it wrote to the console.
You can then use GetStdHandle(STD_OUTPUT_HANDLE) and SetConsoleActiveScreenBuffer to return the console to the original buffer, and CloseHandle to close the extra buffer.
Harry johnston
source share