Help removing the scroll bar from the console

-1

The goal is not to show the scroll bars

#include "stdafx.h"
#include <iostream>
#include <conio.h>
#include <stdlib.h>

using namespace std;
using namespace System;

int main(array<System::String ^> ^args)
{

    int x=10;
    int y=5;

    Console::SetWindowSize(70,40);
    Console::SetCursorPosition(x,y++);Console::ForegroundColor = ConsoleColor::Magenta;cout<<"          __    __  _______   __    __                    ";
    Console::SetCursorPosition(x,y++);Console::ForegroundColor = ConsoleColor::Magenta;cout<<"         /  |  /  |/       \ /  \  /  |                   ";
    Console::SetCursorPosition(x,y++);Console::ForegroundColor = ConsoleColor::Magenta;cout<<"         $$ |  $$ |$$$$$$$  |$$  \  $$ |                   ";
    Console::SetCursorPosition(x,y++);Console::ForegroundColor = ConsoleColor::Magenta;cout<<"         $$ |  $$ |$$ |__$$ |$$$  \ $$ |                   ";
    Console::SetCursorPosition(x,y++);Console::ForegroundColor = ConsoleColor::Magenta;cout<<"         $$ |  $$ |$$    $$/ $$$$  $$ |                   ";
    Console::SetCursorPosition(x,y++);Console::ForegroundColor = ConsoleColor::Magenta;cout<<"         $$ |  $$ |$$$$$$$/  $$ $$ $$ |                   ";
    Console::SetCursorPosition(x,y++);Console::ForegroundColor = ConsoleColor::Magenta;cout<<"         $$ \__ $$ |$$ |      $$ |$$$$ |                   ";
    Console::SetCursorPosition(x,y++);Console::ForegroundColor = ConsoleColor::Magenta;cout<<"         $$    $$/ $$ |      $$ | $$$ |                   ";
    Console::SetCursorPosition(x,y++);Console::ForegroundColor = ConsoleColor::Magenta;cout<<"          $$$$$$/  $$/       $$/   $$/                    ";
    Console::SetCursorPosition(x,y++);Console::ForegroundColor = ConsoleColor::Magenta;cout<<endl;
    Console::SetCursorPosition(x,y++);Console::ForegroundColor = ConsoleColor::Magenta;cout<<endl;
    Console::SetCursorPosition(x,y++);Console::ForegroundColor = ConsoleColor::Magenta;cout<<" _______   ______  __     __  ________  _______  ";
    Console::SetCursorPosition(x,y++);Console::ForegroundColor = ConsoleColor::Magenta;cout<<"/       \ /      |/  |   /  |/        |/       \ ";
    Console::SetCursorPosition(x,y++);Console::ForegroundColor = ConsoleColor::Magenta;cout<<"$$$$$$$  |$$$$$$/ $$ |   $$ |$$$$$$$$/ $$$$$$$  |";
    Console::SetCursorPosition(x,y++);Console::ForegroundColor = ConsoleColor::Magenta;cout<<"$$ |__$$ |  $$ |  $$ |   $$ |$$ |__    $$ |__$$ |";
    Console::SetCursorPosition(x,y++);Console::ForegroundColor = ConsoleColor::Magenta;cout<<"$$    $$<   $$ |   $$  \ /$$/ $$    |   $$    $$< ";
    Console::SetCursorPosition(x,y++);Console::ForegroundColor = ConsoleColor::Magenta;cout<<"$$$$$$$  |  $$ |   $$  /$$/  $$$$$/    $$$$$$$  |";
    Console::SetCursorPosition(x,y++);Console::ForegroundColor = ConsoleColor::Magenta;cout<<"$$ |  $$ | _$$ |_   $$ $$/   $$ |_____ $$ |  $$ |";
    Console::SetCursorPosition(x,y++);Console::ForegroundColor = ConsoleColor::Magenta;cout<<"$$ |  $$ |/ $$   |   $$$/    $$       |$$ |  $$ |";
    Console::SetCursorPosition(x,y++);Console::ForegroundColor = ConsoleColor::Magenta;cout<<"$$/   $$/ $$$$$$/     $/     $$$$$$$$/ $$/   $$/ ";
    Console::SetCursorPosition(x,y++);Console::ForegroundColor = ConsoleColor::Magenta;cout<<endl;


    Console::SetCursorPosition(x,y++);Console::ForegroundColor = ConsoleColor::Cyan;cout<<"\tFUNDAMENTOS DE ALGORITMOS - > 2017-01"<<endl;
    Console::SetCursorPosition(20,y++);Console::ForegroundColor = ConsoleColor::DarkCyan;cout<<"01000011 00100000 00100000"<<endl;
    Console::SetCursorPosition(x,y++);cout<<endl;
    Console::SetCursorPosition(x,y++);cout<<endl;
    Console::SetCursorPosition(30,y++);Console::ForegroundColor = ConsoleColor::Yellow;cout<<"Jugador: "<<char(4)<<endl;
    Console::SetCursorPosition(x,y++);cout<<endl;
    Console::SetCursorPosition(30,y++);Console::ForegroundColor = ConsoleColor::White;cout<<"Enemigo: "<<char(193)<<endl;
    Console::SetCursorPosition(x,y++);cout<<endl;
    Console::SetCursorPosition(30,y++);Console::ForegroundColor = ConsoleColor::Cyan;cout<<"Nave: "<<char(34)<<endl;
    Console::SetCursorPosition(x,y++);cout<<endl;
    Console::SetCursorPosition(30,y++);Console::ForegroundColor = ConsoleColor::Red;cout<<"Bonus: "<<char(169)<<endl;
    Console::SetCursorPosition(x,y++);cout<<endl;
    Console::SetCursorPosition(x,y++);cout<<endl;
    Console::SetCursorPosition(x,y++);cout<<endl;
    Console::SetCursorPosition(x,y++);Console::ForegroundColor = ConsoleColor::Green;cout<<"Presione <ESCAPE> para continuar o <S> para salir"<<endl;


    _getch();                                
    return 0;
}

Note: Achieving the goal would help in my rating compared to the others

    
asked by Giovanni Sobrino Perez 01.06.2017 в 09:29
source

1 answer

3

Based on this question on the English site . Which refers to this forum . The minimum example that must be done to remove the scroll bars is as follows:

#include <windows.h>
#include <iostream>
using namespace std;

int main()
{
    HANDLE hOut;
    CONSOLE_SCREEN_BUFFER_INFO SBInfo;
    COORD NewSBSize;
    int Status;

    hOut = GetStdHandle(STD_OUTPUT_HANDLE);

    GetConsoleScreenBufferInfo(hOut, &SBInfo);
    NewSBSize.X = SBInfo.dwSize.X - 2;
    NewSBSize.Y = SBInfo.dwSize.Y;

    Status = SetConsoleScreenBufferSize(hOut, NewSBSize);
    if (Status == 0)
    {
        Status = GetLastError();
        cout << "SetConsoleScreenBufferSize() failed! Reason : " << Status << endl;
        exit(Status);
    }

    GetConsoleScreenBufferInfo(hOut, &SBInfo);

    cout << "Screen Buffer Size : ";
    cout << SBInfo.dwSize.X << " x ";
    cout << SBInfo.dwSize.Y << endl;

    return 0;
}

I have responded based directly on the answer in English.

    
answered by 01.06.2017 в 10:21