Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <Windows.h>
- void gotoxy(short x, short y)
- {
- HANDLE hConsoleOutput;
- COORD Cursor_an_Pos = { x, y };
- hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
- SetConsoleCursorPosition(hConsoleOutput, Cursor_an_Pos);
- }
- void SetWindowSize(int Width, int Height)
- {
- _COORD coord;
- coord.X = Width;
- coord.Y = Height;
- _SMALL_RECT Rect;
- Rect.Top = 0;
- Rect.Left = 0;
- Rect.Bottom = Height - 1;
- Rect.Right = Width - 1;
- HANDLE Handle = GetStdHandle(STD_OUTPUT_HANDLE);
- if (Handle == NULL)
- {
- cout << "Failure in getting the handle\n" << GetLastError();
- }
- if (!SetConsoleScreenBufferSize(Handle, coord))
- {
- cout << "Failure in setting buffer size\n" << GetLastError();
- }
- if (!SetConsoleWindowInfo(Handle, TRUE, &Rect))
- {
- cout << "Failure in setting window size\n" << GetLastError();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement