KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q57342: Light Pens Tested with Microsoft BASIC

Article: Q57342
Product(s): See article
Version(s): 4.50
Operating System(s): MS-DOS
Keyword(s): ENDUSER | SR# S891206-121 B_BasicCom | mspl13_basic
Last Modified: 22-JAN-1990

The following light pens by the LightPen Company were tested with
QuickBASIC Version 4.50, Microsoft BASIC Compiler Versions 6.00 and
6.00b, and Microsoft BASIC Professional Development System (PDS)
Version 7.00:

1. Light Pen
2. Soft Pen

The following code example is from Page 315 of the "Microsoft
QuickBASIC 4.0: BASIC Language Reference" manual under the example for
the PEN function. This code example was used to test the light pen. If
you do not have a light pen, pushing both buttons on the mouse at the
same time simulates a light pen being on.

The code produces an endless loop to give the current position and
status of the pen.

Compile and link with the following command lines:

   BC test.bas;
   LINK test.obj,,,BRUNxx.Lib;

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

CLS
PEN ON
DO
   p = PEN(3)
   LOCATE 1,1: PRINT "Pen Is ";
   IF p THEN PRINT "down" ELSE PRINT "up"
   x = PEN (4) : y = PEN(5)
   PRINT "x=" x, "y=" y
LOOP

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.