How to resolve the algorithm Terminal control/Dimensions step by step in the AutoHotkey programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Terminal control/Dimensions step by step in the AutoHotkey programming language

Table of Contents

Problem Statement

Determine the height and width of the terminal, and store this information into variables for subsequent use.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Terminal control/Dimensions step by step in the AutoHotkey programming language

Source code in the autohotkey programming language

DllCall( "AllocConsole" ) ; create a console if not launched from one
hConsole := DllCall( "GetStdHandle", int, STDOUT := -11 )

MsgBox Resize the console...

VarSetCapacity(csbi, 22) ; CONSOLE_SCREEN_BUFFER_INFO structure
DllCall("GetConsoleScreenBufferInfo", UPtr, hConsole, UPtr, &csbi)
Left   := NumGet(csbi, 10, "short")
Top    := NumGet(csbi, 12, "short")
Right  := NumGet(csbi, 14, "short")
Bottom := NumGet(csbi, 16, "short")

columns	:= right - left + 1
rows	:= bottom - top + 1
MsgBox %columns% columns and %rows% rows


  

You may also check:How to resolve the algorithm Tokenize a string step by step in the Lua programming language
You may also check:How to resolve the algorithm File size step by step in the Ruby programming language
You may also check:How to resolve the algorithm Factorial step by step in the LOLCODE programming language
You may also check:How to resolve the algorithm Walk a directory/Recursively step by step in the Swift programming language
You may also check:How to resolve the algorithm Special characters step by step in the ALGOL W programming language