Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Incease the buffer size of the cmd window
#7
s
I redid SetConsuleBufferWindowSize2 slightly. Made it easier to resize. Only need to change width and height at the beginning now. Also fixed small bug in resizing cmd window, window dimensions need to be smaller than buffer when resizing even though will be same dimensions after.

ssimop i have been meaning to post this update but forgot till now

Function SetConsuleBufferWindowSize2a
Code:
Copy      Help
int width height w hwnd
width = 100;; console width is in colums
height = 40;;console height is in rows

;run "$system$\cmd.exe" "" "" "C:\" 16|0x10000 win("" "ConsoleWindowClass") w ;; use this if you want to run hidden while you resize console
run "$system$\cmd.exe" "" "" "*" 0x10800 win("" "ConsoleWindowClass") w

if(!hwnd) hwnd=w; if(!hwnd) ret
if(!GetWindowThreadProcessId(hwnd &_i)) ret
lock
FreeConsole
if(!AttachConsole(_i)) ret

int hConsole = GetStdHandle(STD_OUTPUT_HANDLE)

CONSOLE_SCREEN_BUFFER_INFO scbi

GetConsoleScreenBufferInfo(hConsole &scbi)

COORD dwsize
dwsize.X = width
dwsize.Y = height
SetConsoleScreenBufferSize(hConsole dwsize)
scbi.srWindow.Bottom = height-1
scbi.srWindow.Right = width-1
scbi.srWindow.Left = 0
scbi.srWindow.Top = 0

SMALL_RECT srctWindow
srctWindow=scbi.srWindow
SetConsoleWindowInfo(hConsole TRUE &srctWindow)
FreeConsole
;hid- w ;;; use this if you run console hidden to show resized
;act w


Messages In This Thread
RE: Incease the buffer size of the cmd window - by Kevin - 09-02-2018, 09:46 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)