COLOR Statement in SCREEN 11 Gives "Illegal Function Call" (50461)



The information in this article applies to:

  • Microsoft QuickBASIC 4.0
  • Microsoft QuickBASIC 4.0b
  • Microsoft QuickBASIC 4.5

This article was previously published under Q50461

SUMMARY

The COLOR statement correctly returns an "Illegal Function Call" if used in SCREEN 11. The only way to change the color in SCREEN 11 is to use the PALETTE statement. However, note that the PALETTE statement may not work with a video card that is not 100-percent compatible with the IBM standard VGA or MCGA. (SCREEN 11 requires VGA or MCGA.)

The following resources incorrectly state that the COLOR statement is valid in SCREEN modes 11-13; they should instead say SCREEN modes 12-13:
  1. Two occurrences, on Page 109 of the "Microsoft QuickBasic 4.0: Basic Language Reference" manual for QuickBasic Versions 4.00 and 4.00b
  2. Two occurrences, on Page 109 of the "Microsoft Basic Compiler 6.0: Basic Language Reference" manual for Versions 6.00 and 6.00b
  3. One occurrence, under the COLOR statement in the QB Advisor online Help system for QuickBasic Version 4.50

MORE INFORMATION

This documentation error was corrected in the "Microsoft QuickBasic 4.5: Basic Language Reference" manual for QuickBasic Version 4.50, in the Microsoft Basic Professional Development System (PDS) 7.00 "Basic Language Reference," and in the Microsoft Advisor online Help system in the QuickBasic Extended editor (QBX.EXE) shipped with Basic PDS Version 7.00.

The PALETTE statement can be used instead of the COLOR statement in SCREEN 11 to set the foreground and background colors. Note that the foreground color can only be set for graphics statements; text will always be blue.

To change the foreground color in SCREEN 11, the following PALETTE statement must be used:
   PALETTE 1, color
				
To change the background color in SCREEN 11, the following PALETTE statement must be used:
   PALETTE 0, color
				
Below is another code example demonstrating how to set the foreground and background colors in SCREEN 11 using the PALETTE statement:
' VGA color equation: COLOR number = 65536 * blue + 256 * green + red
'   where red, blue, and green are numbers between 0 and 63
CLS
SCREEN 11
background& = 256 * 63   'bright green
foreground& = 63         'bright red
PALETTE 0, background& 
PALETTE 1, foreground& 
LINE (10, 240)-(630, 240)
WHILE INKEY$ = "": WEND

Modification Type:MinorLast Reviewed:1/8/2003
Keywords:KB50461 kbAudDeveloper