|Posted by:||muta.…@gmail.com (mutazil…@gmail.com)|
|Date:||Tue, 20 Oct 2020|
I (believe I) have figured out the behavior of GetConsoleScreenBufferInfo
hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
printf("size char_info is %d
", (int)csbi.dwSize.X, (int)csbi.dwSize.Y);
", (int)csbi.dwMaximumWindowSize.X, (int)csbi.dwMaximumWindowSize.Y);
", (int)csbi.srWindow.Right, (int)csbi.srWindow.Bottom);
The window sizes (rows) include the size of the
scrollback buffer. Except for the "Maximum" -
that reflects the actual screen size.
Regardless, when I attempt to write to row 16
sz.X = 16;
sz.Y = 1;
coord.X = 0;
coord.Y = 0;
rect.Left = 1;
rect.Top = 10; /* was 10 */
rect.Right = 17; /* was 17 */
rect.Bottom = 10; /* was 10 */
ret = WriteConsoleOutput(hConsoleOutput,
it does actually write to row 16, but it is row 16
of the scrollback buffer, so it's not actually
visible on my screen.
If I run "cls" first, then everything is reset and
everything works as I want.
My question is - is there a call to clear the
screen? Or some other approach?