Advertisement
Iwanicki

Resizing Console

Nov 10th, 2012
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void ResizeConsoleWindow()
  2. {
  3.     HANDLE hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
  4.     COORD Size = {ProgramWindowXSize, ProgramWindowYSize};  /* stałe które mamy mieć w programie */
  5.     CONSOLE_FONT_INFO FontInfo;
  6.     GetCurrentConsoleFont(hstdout, false, &FontInfo);
  7.  
  8.     SetConsoleScreenBufferSize(hstdout, Size);  /* zmienia wielkosc bufora ekranu */
  9.     MoveWindow(GetConsoleWindow(), 0, 0, ProgramWindowXSize * FontInfo.dwFontSize.X,
  10.            ProgramWindowYSize * FontInfo.dwFontSize.Y, TRUE);
  11.     /* przemieszcza i zmienia rozmiar okna. Nie może być większy niż rozmiar bufora ekranu. Rozmiar podawany w pikselach, jeśli chcemy w znakach to musimy pomnożyć przez rozmiar czcionki :) */
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement