Changing size of Win2k/XP console?

S

Sheeps United

Hi, I'm quite a newbie but I've managed to google around before asking
stupid Q's here.

I'm wrestling with little (amateurish) console program and I would like
change its size. I also know that it could be done with Windows API call. I
tried doing that myself but no good.

Could anyone help me?
 
P

Peter Hansen

Sheeps said:
Hi, I'm quite a newbie but I've managed to google around before asking
stupid Q's here.

I'm wrestling with little (amateurish) console program and I would like
change its size. I also know that it could be done with Windows API call. I
tried doing that myself but no good.

Could anyone help me?

Which Windows API call did you try using? Can you show us a line or two
of code that you tried? Most likely then someone will be able to point
out what went wrong and it will work. (Chances are that very few here
know the API call required, so by not mentioning it you're severely
limiting the number of answers you are likely to get.)

-Peter
 
S

Sheeps United

Peter Hansen said:
Which Windows API call did you try using? Can you show us a line or two
of code that you tried? Most likely then someone will be able to point
out what went wrong and it will work. (Chances are that very few here
know the API call required, so by not mentioning it you're severely
limiting the number of answers you are likely to get.)

No actual code, yet.

I'm far from sure if it's the right one, but I think it could be
SetConsoleScreenBufferSize from Kernel32. Hrr, for some reason I have nasty
feeling in back of my head... That could also be totally wrong way of
approaching.
 
C

Chris Lambacher

Referring to the documenation you will have to use that function and
SetConsoleWindowInfo to get the effect you want. Basically
SetConsoleScreenBufferSize sets the size for the console and
SetConsoleWindowInfo sets the size for the window containing the console. The
window size can't be bigger that the console size. If the console size is
bigger than the window, you will end up with scrollbars.
http://msdn.microsoft.com/library/d...s/dllproc/base/setconsolescreenbuffersize.asp
http://msdn.microsoft.com/library/d...s/dllproc/base/setconsolescreenbuffersize.asp

You might want the get function as well:
GetConsoleScreenBufferInfo
http://msdn.microsoft.com/library/d...s/dllproc/base/setconsolescreenbuffersize.asp

When in doubt about the Microsoft API see the MSDN.

-Chris



-Chris
 
C

Christopher Subich

Sheeps said:
I'm far from sure if it's the right one, but I think it could be
SetConsoleScreenBufferSize from Kernel32. Hrr, for some reason I have nasty
feeling in back of my head... That could also be totally wrong way of
approaching.

I have the source code to a win32-console program lying around, and it
uses SetConsoleScreenBufferSize from C++ to do just that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top