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



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 3.0
  • Microsoft Visual FoxPro for Windows 3.0b
  • Microsoft Visual FoxPro for Windows 5.0
  • Microsoft Visual FoxPro for Windows 5.0a
  • Microsoft Visual FoxPro for Windows 6.0
  • Microsoft Visual FoxPro for Windows 7.0
  • Microsoft FoxPro for MS-DOS 2.0
  • Microsoft FoxPro for MS-DOS 2.5
  • Microsoft FoxPro for MS-DOS 2.5a
  • Microsoft FoxPro for MS-DOS 2.5b

This article was previously published under Q113174

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:
      * ensure the NUMLOCK key is on
      STORE .T. to istrue
      IF NUMLOCK()
         IF istrue
            WAIT WINDOW 'they are both true'
         ENDIF
      ENDIF
				

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 this behavior, use the following code example:
      * ensure the NUMLOCK key is on
      STORE .T. to istrue
      IF NUMLOCK() AND istrue
         WAIT WINDOW 'they are both true'
      ENDIF
				
Note that the WAIT window message does not appear as it should in this example.

Modification Type:MajorLast Reviewed:5/6/2003
Keywords:kbbug kbpending kbProgramming KB113174