BUG: Incorrect Return Value with CAPSLOCK() or NUMLOCK()

Last reviewed: April 18, 1995
Article ID: Q113174
The information in this article applies to:
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5x, 2.6

SYMPTOMS

The logical result of an operation involving the NUMLOCK() and CAPSLOCK() functions incorrectly returns a FALSE value when either function is used with the logical expression operator and the second expression returns TRUE.

RESOLUTION

To work around this behavior, you must use a nested IF statement if you are going to use the result of either NUMLOCK() or CAPSLOCK() in conjunction with another logical expression.

For example, the following code will correctly display the WAIT window message:

   ***Begin Code example of solution***
      * ensure the NUMLOCK key is on
      STORE .T. to istrue
      IF NUMLOCK()
         IF istrue
            WAIT WINDOW 'they are both true'
         ENDIF
      ENDIF
   ***End code example***

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Behavior

To reproduce the incorrect behavior, use the following code example:

   ***Begin code example***
      * ensure the NUMLOCK key is on
      STORE .T. to istrue
      IF NUMLOCK() AND istrue
         WAIT WINDOW 'they are both true'
      ENDIF
   ***End of code example***

Note that the WAIT window message does not appear as it should in this example.


Additional reference words: FoxDos 2.00 2.50 2.50a 2.50b 2.60 true logic
logical
both buglist2.00 buglist2.50 buglist2.50a buglist2.50b buglist2.60
KBCategory: kbprg kbbuglist
KBSubcategory:


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.

Last reviewed: April 18, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.