[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 406
  • Last Modified:

Console scrolling

Hi, how can I remove and or disable scrolling my console applications?
I would like to have my programs so that the user can not scroll, and
even have it possibly where the scroll bars do not display.
0
List244
Asked:
List244
  • 2
1 Solution
 
jkrCommented:
#include <windows.h>
#include <stdio.h>

void DisableScrolling() {

COORD cSize;
CONSOLE_SCREEN_BUFFER_INFO csbi;
HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE);

if (!GetConsoleScreenBufferInfo(hCon,&csbi)){

    printf("GetConsoleScreenBufferInfo: %d\n", GetLastError());
}

cSize.X = csbi.srWindow.Right - csbi.srWindow.Left + 1;
cSize.Y = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;

if (!SetConsoleScreenBufferSize(hCon,cSize)){

    printf("SetConsoleScreenBufferSize: %d\n", GetLastError());
}
}

void main () {

DisableScrolling();

Sleep(10000);
}
0
 
List244Author Commented:
Thanks again JKR.
0
 
jkrCommented:
... and some background info: http://windowssdk.msdn.microsoft.com/library/en-us/DllProc/base/window_and_screen_buffer_size.asp ("Window and Screen Buffer Size")
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now