KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q43900: VIEW SCREEN Parameters Passed through CHAIN Using BRUNxx.EXE

Article: Q43900
Product(s): See article
Version(s): 4.00 4.00b 4.50
Operating System(s): MS-DOS
Keyword(s): ENDUSER | SR# S890421-68 B_BasicCom | mspl13_basic
Last Modified: 15-DEC-1989

An "Illegal function call" may be generated by a graphics PUT
statement under the following conditions:

1. The first BASIC program performs a VIEW SCREEN statement to set up
   a graphics area.

2. The first program CHAINs to a second BASIC program.

3. The second program attempts to perform a graphics PUT statement
   outside the boundaries of that previously defined VIEW SCREEN.

This error occurs only when the BASIC programs are run from the QB.EXE
environment or when compiled requiring the run-time module (BRUNxx.EXE
in QuickBASIC and the BASIC compiler; BRT70xxx.EXE in BASIC PDS
Version 7.00).

This information applies to Microsoft QuickBASIC Versions 4.00, 4.00b,
and 4.50 for MS-DOS, to Microsoft BASIC Compiler Versions 6.00 and
6.00b for MS-DOS and MS OS/2, and to Microsoft BASIC PDS Version 7.00
for MS-DOS and MS OS/2.

Using the VIEW SCREEN statement in BASIC allows you to create a
virtual view port for all graphic images created or PUT on the screen.
Graphic images are displayed on the screen only if they fall in that
virtual view port. This feature can be a useful for writing graphic
routines that are to be used with CHAINed QuickBASIC programs.

This error can be avoided by using any or all of the following
methods:

1. Changing screen modes with the SCREEN statement.

2. Issuing another VIEW SCREEN statement with parameters large enough
   to handle additional graphic images.

3. Compiling the programs with the /O (stand-alone) switch.

Code Example
------------

The following code generates the "Illegal function call" error as soon
as the image is displayed outside of the previously defined VIEW
SCREEN port.

' PROGRAM:   A.BAS
SCREEN 8
VIEW SCREEN (250,75)-(390,125)
LINE (250,75)-(390,125), ,B
PRINT "This is the View Screen Box"
LOCATE 22,1
PRINT "Press a key to CHAIN to B.BAS"
SLEEP
CHAIN "B.BAS"
END

' PROGRAM:   B.BAS
DIM C#(3000)
SCREEN 8
LINE (250,75)-(390,125), , B
LINE (300,85)-(350,110), 1, BF
GET (300,85)-(350,110), C#
FOR i = 1 TO 100
   PUT (225 + i, 50 + i), C#  'This will generate the error as soon as
NEXT i                               'the box leaves the bottom of the views
END

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.