Microsoft KB Archive/31428

= Making Screen MODE Such as CO40 Remain After Program Is Run =

Article ID: 31428

Article Last Modified on 11/21/2006



This article was previously published under Q31428



SUMMARY
Screen attributes set with the SHELL &quot;MODE CO40&quot; command do not remain changed upon exiting the environment or ending program execution because QuickBasic stores the original screen settings before the program executes. When execution terminates, all screen attributes are restored to their original conditions.

By using the ANSI.SYS escape codes, screen settings such as text colors and background colors can be changed. The following example demonstrates how to change to screen mode 40.



MORE INFORMATION
If the program is run while inside the QuickBasic Version 3.00 environment, the screen is restored to its initial condition, even if ANSI calls are made. QuickBasic Versions 4.00 and later keep the changes in or out of the environment if the screen mode is changed.

The following steps let you utilize ANSI control codes:


 * 1) Put the statement DEVICE=ANSI.SYS in the CONFIG.SYS file on the root directory of the boot-up disk.
 * 2) Reboot.
 * 3) OPEN the CONsole as a device for output.
 * 4) Redirect the OUTPUT to the CONsole device.
 * 5) Send the ANSI codes to change the screen attributes.
 * 6) CLOSE the CONsole when done.

The following code demonstrates this process: CLS escape$ = CHR$(27) + &quot;[&quot;

screen0$ = &quot;0h&quot; ' 40 X 25 - characters black and white screen1$ = &quot;1h&quot; ' 40 X 25 - characters color screen2$ = &quot;2h&quot; ' 80 X 25 - characters black and white screen3$ = &quot;3h&quot; ' 80 X 25 - characters color screen4$ = &quot;4h&quot; ' 320 X 200 - pixels   black and white screen5$ = &quot;5h&quot; ' 320 X 200 - pixels   black and white screen6$ = &quot;6h&quot; ' 640 X 200 - pixels   black and white screen7$ = &quot;?7h&quot; ' wrap at end line ?

OPEN &quot;CON&quot; FOR OUTPUT AS 1 PRINT #1, escape$ + screen1$ + &quot;Wow, 40 by 25&quot; CLOSE 1

Additional query words: QuickBas

Keywords: KB31428

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.