From QB64 Wiki
Revision as of 10:41, 7 February 2021 by Dkearns (talk | contribs) (Add missing metacommands)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Metacommands are program wide commands that start with $.

Legacy metacommands (QBasic/QuickBASIC)


REM $INCLUDE: 'QB.BI' 'loads a reference file or library
REM $DYNAMIC 'enables resizing of array dimensions with REDIM
REM $STATIC 'arrays cannot be resized once dimensioned


  • QBasic metacommands are normally used at the program start and are in effect throughout the program.
  • QBasic metacommands are always prefixed with $ and MUST be commented with ' or REM.
  • $INCLUDE is always followed by a colon and the full filename must be included in single quotes.
  • $DYNAMIC allows larger arrays that are changeable in size at runtime.
  • $STATIC makes all arrays unchangeable in size.
  • QBasic metacommands should have their own program line because they are commented.

QB64 metacommands


$ASSERTS[:CONSOLE] 'enables assertions
$CHECKING:{ON|OFF} 'disables QB64 C++ event and error checking (no spaces)
$COLOR:{0|32} 'adds named color constants to the program
$CONSOLE[:ONLY] 'creates a QB64 console window throughout the program
$ERROR message 'triggers a compilation error, useful inside $IF blocks
$EXEICON:'iconfile.ico' 'embeds an .ICO file into the final executable (Windows only)
$IF...$END IF 'precompiler conditional directive
$LET variable = expression 'defines precompiler flags
$NOPREFIX 'allows QB64 keywords without the leading _
$RESIZE:{ON|OFF|STRETCH|SMOOTH} 'determines if re-sizing of the program screen by the user is allowed
$SCREENHIDE 'hides the QB64 program window throughout the program
$SCREENSHOW 'displays the main QB64 program window
$VERSIONINFO:key=value[, ...] 'embeds version info metadata into the final executable (Windows only)
$VIRTUALKEYBOARD:{ON|OFF} 'enables the virtual keyboard (Deprecated)


  • $INCLUDE can be used at the beginning or at the end of program SUB procedures.
  • $ASSERTS enables the _ASSERT macro.
  • $CHECKING OFF should only be used with errorless code where every CPU cycle counts! Use ON to re-enable event checking. Event checking can be turned OFF or ON throughout a program.
  • $COLOR includes named color constants in a program.
  • $CONSOLE creates a console window which can be turned off later with _CONSOLE OFF.
  • $EXEICON embeds a designated icon file into the compiled EXE file. (Windows ONLY)
  • $ERROR MESSAGE causes a compilation error whenever QB64 attempts to compile it, displaying MESSAGE to the user. This is useful if inside a $IF block, as the error can be conditional.
  • $IF...$END IF allows selective inclusion of code in the final program.
  • $LET used to set a flag variable for the precompiler.
  • $NOPREFIX allows all QB64 functions and statements to be used without the leading underscore (_).
  • $RESIZE allows a user to resize the program window. OFF is default.
  • $SCREENHIDE hides the QB64 program window throughout the program until $SCREENSHOW is used.
  • $VERSIONINFO adds metadata to Windows only binaries for identification purposes across the OS.
  • $VIRTUALKEYBOARD turns the virtual keyboard ON or OFF for use in touch-enabled devices. (DEPRECATED)
  • Do not comment out with ' or REM QB64-specific metacommands.

See also

Keyword Reference - Alphabetical
Keyword Reference - By Usage
Main Wiki Page