[ask] how to remove this scrollbar?

This is a discussion on [ask] how to remove this scrollbar? within the C++ Programming forums, part of the General Programming Boards category; http://img215.imageshack.us/img215/6281/removems2.jpg i've googled for it but haven't found yet.. i want the scrollbar to be removed when the program is ...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    26

    [ask] how to remove this scrollbar?

    http://img215.imageshack.us/img215/6281/removems2.jpg

    i've googled for it but haven't found yet..

    i want the scrollbar to be removed when the program is open, i once found program that is able to do this.. i wonder how it's work?

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,666
    You'll probably have to make the console screen buffer the same size as the window - or resize the window so that it shows the entire screen buffer.

    http://msdn2.microsoft.com/en-us/library/ms682073.aspx

    gg

  3. #3
    Registered User
    Join Date
    Apr 2007
    Posts
    26
    Quote Originally Posted by Codeplug View Post
    You'll probably have to make the console screen buffer the same size as the window - or resize the window so that it shows the entire screen buffer.

    http://msdn2.microsoft.com/en-us/library/ms682073.aspx

    gg
    uh.. i don't understand.. i'm really newbie to this..

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    7,317
    It will be difficult for you to do this in your program.

    If you just want it to go away on your machine, then with the console open click on the icon in the top left of the window then scroll down and select Properties.

    Switch to the Layout tab and under Screen Buffer Size change the Height to the same value as the Height under Window Size (probably 25). Then click OK. When it asks if you want to "Apply properties to current window only" or "Save properties for future windows with same title" then pick the second one and hit OK. This should remove the scrollbar from the console every time you run it for that particular program.

  5. #5
    Registered User
    Join Date
    Apr 2007
    Posts
    26
    Quote Originally Posted by Daved View Post
    It will be difficult for you to do this in your program.

    If you just want it to go away on your machine, then with the console open click on the icon in the top left of the window then scroll down and select Properties.

    Switch to the Layout tab and under Screen Buffer Size change the Height to the same value as the Height under Window Size (probably 25). Then click OK. When it asks if you want to "Apply properties to current window only" or "Save properties for future windows with same title" then pick the second one and hit OK. This should remove the scrollbar from the console every time you run it for that particular program.
    no.. i want it to be default in every computer that opens it..
    is it not possible for me?
    Last edited by LeonLanford; 01-16-2008 at 12:25 PM.

  6. #6
    Registered User
    Join Date
    Jan 2005
    Posts
    7,317
    It is possible for you (I think), it just isn't that easy. Follow the link that Codeplug provided. Find a function that does what he said. Read about that function, maybe search for examples. If somebody has an example for you they might post it here, but in the meantime you can do some research starting with that link and you might find the answer.

  7. #7
    The larch
    Join Date
    May 2006
    Posts
    3,573
    This seems to work but I give no guarantees and take no responsibility.

    Code:
    #include <windows.h>
    
    void remove_scrollbar()
    {
        HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
        CONSOLE_SCREEN_BUFFER_INFO info;
        GetConsoleScreenBufferInfo(handle, &info);
        COORD new_size = 
        {
            info.srWindow.Right - info.srWindow.Left + 1,
            info.srWindow.Bottom - info.srWindow.Top + 1
        };
        SetConsoleScreenBufferSize(handle, new_size);
    }
    
    int main()
    {
        remove_scrollbar();
    }
    However, if you are beginner you should concentrate more on learning the language and less on OS dependent things that add very little to the program. If you write something that is useful to you and others, few are likely to be annoyed by the scrollbars. And if you have learnt enough of the language, you'll be able to understand and use msdn references (or other 3rd party libraries) on your own.
    Last edited by anon; 01-16-2008 at 01:47 PM.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  8. #8
    Registered User
    Join Date
    Apr 2007
    Posts
    26
    Quote Originally Posted by anon View Post
    This seems to work but I give no guarantees and take no responsibility.

    Code:
    #include <windows.h>
    
    void remove_scrollbar()
    {
        HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
        CONSOLE_SCREEN_BUFFER_INFO info;
        GetConsoleScreenBufferInfo(handle, &info);
        COORD new_size = 
        {
            info.srWindow.Right - info.srWindow.Left + 1,
            info.srWindow.Bottom - info.srWindow.Top + 1
        };
        SetConsoleScreenBufferSize(handle, new_size);
    }
    
    int main()
    {
        remove_scrollbar();
    }
    However, if you are beginner you should concentrate more on learning the language and less on OS dependent things that add very little to the program. If you write something that is useful to you and others, few are likely to be annoyed by the scrollbars. And if you have learnt enough of the language, you'll be able to understand and use msdn references (or other 3rd party libraries) on your own.
    wow it's worked! thanks a lot!
    i want to create game so i need to define some setting to the exe, i've already learn c++ for half year but never see some code like

    Code:
    BOOL WINAPI GetConsoleScreenBufferInfo(
      __in   HANDLE hConsoleOutput,
      __out  PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo
    );
    so i don't know how to use it..

    thanks for the rest also..

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Running remove() gets permission denied error...
    By edomingox in forum C Programming
    Replies: 4
    Last Post: 01-11-2009, 11:55 AM
  2. randomly remove elements
    By joan in forum C++ Programming
    Replies: 6
    Last Post: 12-06-2006, 12:46 PM
  3. randomly remove elements
    By joan in forum C++ Programming
    Replies: 2
    Last Post: 12-06-2006, 11:22 AM
  4. C win32 API - Scrollbar won't work
    By Matt-Stevens in forum Windows Programming
    Replies: 2
    Last Post: 08-03-2006, 09:05 PM
  5. sending messages to a scrollbar
    By stormbringer in forum Windows Programming
    Replies: 1
    Last Post: 05-16-2003, 12:32 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21