QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The _CONSOLE statement can be used to turn a console window ON/OFF.

Syntax

_CONSOLE {OFF|ON} _DEST _CONSOLE

Example(s)

Hiding and displaying a console window. Use _DELAY to place console in front of main program window.


$CONSOLE
_CONSOLE OFF 'close original console
_DELAY 2
_CONSOLE ON 'place console above program window

_DEST _CONSOLE 
INPUT "Enter your name: ", nme$ 'get program input
_CONSOLE OFF 'close console

_DEST 0 'destination program window
PRINT nme$
END 

Explanation: The _DEST must be changed with _DEST _CONSOLE to get INPUT from the $CONSOLE screen.

_CONSOLETITLE can be used to create a console title, but it must be redone every time the console window is restored once turned off:


$CONSOLE

_CONSOLETITLE "firstone"
_DELAY 10

_CONSOLE OFF
_DELAY 10

_CONSOLE ON
_CONSOLETITLE "secondone"

Note: Some versions of Windows may display the program path or Administrator: prefix in console title bars.

See Also