Mar 11, 2013 at 3:49pm UTC
Hey everyone
I am looking for a function or a maner that sizes the console window
thanks for reading
Mar 13, 2013 at 12:08pm UTC
Thanks a lot @whitenite1
but It did not work for me
I am programming in block notes compiler is that a problem because it did not recongnize the "namespace System"
Mar 13, 2013 at 12:23pm UTC
@Tecno01
Sorry, I have no idea what 'block notes compiler', is. I've heard of 'Code::Blocks', but I'm not sure if that is what you meant. In any case, I'm not not familiar with either one, to be able to give you a definitive answer.
Mar 13, 2013 at 1:54pm UTC
I just threw this together, there are no guarantees that it is correct, or works at all:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
#define _WIN32_WINNT 0x0501
#include <conio.h>
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
COORD a;
a.X = 90;
a.Y = 300;
SMALL_RECT rect;
rect.Top = 0;
rect.Left = 0;
rect.Bottom = 10;
rect.Right = 30;
SetConsoleScreenBufferSize(handle, a);
SetConsoleWindowInfo(handle, 1, &rect);
cout << "Making console bigger" << endl;
for (int i=0; i< 20; i++)
{
rect.Bottom++;
rect.Right++;
int x = SetConsoleWindowInfo(handle, 1, &rect);
if (x == 0)
{
cout << GetLastError() << endl;
}
// 6 - handle is invalid
// 87 - invalid parameter
Sleep(200);
}
getch();
return 0;
}
Last edited on Mar 13, 2013 at 2:59pm UTC
Mar 14, 2013 at 1:28pm UTC
@whitenite1
Oh my god I can't beleive I wrote that ,I meant Code::Blocks
but thanks anyway
for you @Chervil
thats what I'am looking for
a 100000 thks