Nothing's ever easy though. The problem with this is that since there is no scrollable history, I lose the vertical scrollbar. This has an unpleasant effect on our application, because the scrollbar's disappearance makes the window width resize. Notably, the application has two modes :
1. Scrollable past history using the mouse wheel, or the scrollbar
2. A special function in which we don't want the scrollback to work, as it disrupts screen drawing and presentation (however we need to retain the vertical scrollbar, otherwise the window width decreases and looks unsatisfactory)
Does anyone know if there's a way to clear the output buffer while retaining the scrollbar? Or perhaps even a better way. Thanks.
Code: Select all
OpenConsole()
EnableExplicit
Define csbi.CONSOLE_SCREEN_BUFFER_INFO
Define hOutput
Define ok, a
Define newbuffer.COORD
newbuffer\x = 120
newbuffer\y = 31 ; <------ Change screen buffer size to 30 and we lose the vert. scrollbar
hOutput = GetStdHandle_( #STD_OUTPUT_HANDLE )
ok = SetConsoleScreenBufferSize_(hOutput, newbuffer\x | (newbuffer\y << 16))
PrintN("[ OK = " + ok + " ]")
GetConsoleScreenBufferInfo_(hOutput, @csbi.CONSOLE_SCREEN_BUFFER_INFO)
ok = SetConsoleWindowInfo_(hOutput, 1, @csbi\srWindow)
PrintN("[ OK = " + ok + " ]")
For a= 1 To 28
PrintN("" + a)
Next
Input()