Resize using WIDTH (windows)

General FreeBASIC programming questions.
Post Reply
VANYA
Posts: 1754
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Resize using WIDTH (windows)

Post by VANYA »

Hi all!

I can't use the standard WIDTH command to correctly get/set console size. Here's a simple example:

Code: Select all

dim shared as long iNewHeight , iOldHeight

do
    
    Dim As Integer iPw = width
    
    iNewHeight = HiWord(iPw)
    
    if iNewHeight <> iOldHeight then
        
        iOldHeight = iNewHeight
        
        width , iOldHeight ' resizes only downwards
        
    else
        
        cls
        
        locate iNewHeight-1 , 1
        
        ? iNewHeight

    EndIf
    
    sleep(1)
    
Loop
Now, if you try to resize the console window with the mouse, you can only change to a smaller side.
If you remove the command WIDTH, iOldHeight, then the dimensions I can get and the size of the console changes upwards , but the text is displayed incorrectly (instead of the penultimate line, the text is displayed on the first line)

P.S. There are no such problems in linux.
Post Reply