Enlarge the window

Hello everyone, do you know if it is possible to extend the code via the console window?
You could go under the console settings probably.
I could use code through cpp.
@angelk

Not sure if you were asking if it's possible to make the console screen larger, or not, but here is a way to do that.

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
47
48
49
// Resize Console.cpp : main project file.

#include <conio.h> // For WaitKey() function
#include <iostream>
#include <string>
#include <windows.h>

using namespace std;
using namespace System;

void WaitKey();

int main()
{
	int x,y = 27;
	const int width = 91, height = 60;
	Console::SetWindowSize(width, height );
	cout << "Making console, narrower!!" << endl;
	for(x=120;x>=width;x--)
	{
		
		Console::SetWindowSize(x, height);
		Sleep(100);
	}
	cout << "Making console, shorter!!" << endl;
	for(x=60;x>26;x--)
	{
		Console::SetWindowSize(width, x);
		Sleep(100);
	}
cout << "Making console, larger!!" << endl;
	for(x=60;x<=80;x++)
	{
		
		Console::SetWindowSize(x, y);
		y++;
		Sleep(100);
	}
	WaitKey();
	return 0;
}

void WaitKey()
{
	cout << "\n\n\n\t\t\t     Press ENTER to continue...";
	while (_kbhit()) _getch(); // Empty the input buffer
	_getch(); // Wait for a key
	while (_kbhit()) _getch(); // Empty the input buffer (some keys sends two messages)
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <windows.h>

int main()
{
    int leftpos = 10;
    int toppos = 10;
    int width = 450;
    int height = 100;
    for(int i=0;i<3;i++)
    {
        HWND console = GetConsoleWindow();
        MoveWindow(console, leftpos, toppos, width, height, TRUE);
        width += 50;
        height += 300;
        Sleep(1000);
    }
    return 0;
}
@Chriscpp thank you very much. :)

P.S.
Another thing after the console, I open a initwindow.
How can I do that after the initwindow is opened, the console window remains in the foreground with respect to the initwindow? xD
Topic archived. No new replies allowed.