If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: about console size

Originally Posted by Cambalinho

why they complicate so many in C++ with API functions
i get the same error
6. i don't know what means

As explained, error 6 means that the value of the handle passed to the function SetConsoleWindowInfo as first parameter is not valid. As I asked before, how do you obtain this value? You have it named ConsoleDC but a console handle is nothing at all to do with a Device Context in the sense used in Windows gui programming!

The program below when run from a console will set the buffer to be the same size as the console window and will therefore remove the scroll bars.

Note you should always test for errors after calling a function! - omitted in main here for clarity

why they complicate so many in C++ with API functions

Windows/console programming is fairly complicated. That's why you need to learn how to do these things. You can't just sit down and write these kinds of programs 'on the hoof'! There are about 70 api functions alone just referring to console programming!

All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.
C, C++ Compiler: Microsoft VS2015

Re: about console size

if you don't use DC, you can't use graphics lol
i build a game in console heheheheh

Good luck! You don't normally do graphics (except character graphics) in a console window - thats why its called a console and is just text! If you want graphics, I suggest you create a normal windows program.

what is the diference between HWND and HANDLE?

In console terms, a lot! They are very different things. A HANDLE is a handle to either the input, output or error buffers whereas HWND is a handle to the console window itself. All the console api functions need a console handle (HANDLE) as opposed to a windows handle (HWND). To get console handles use GetStdHandle(...).

Last edited by 2kaud; August 19th, 2013 at 05:01 PM.

All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.
C, C++ Compiler: Microsoft VS2015

Re: about console size

You don't do graphics (except character graphics) in a console window - thats why its called a console and is just text! If you want graphics, create a normal windows program.

In console terms, a lot! They are very different things. A HANDLE is a handle to either the input, output or error buffers whereas HWND is a handle to the console window itself. All the console api functions need a console handle (HANDLE) as opposed to a windows handle (HWND). To get console handles use GetStdHandle(...).

why my class have hwnd and dc(and handle now)? for the programmer be free