12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
// 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) }
123456789101112131415161718
#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; }