Microsoft KB Archive/43023
Article ID: 43023
Article Last Modified on 11/21/2006
This article was previously published under Q43023
The programs below demonstrate that SETUEVENT is mistakenly remembered in the QuickBasic version 4.5 environment (QB.EXE) between program invocations. This is incorrect behavior, because starting a new program should reset and remove event handlers from programs previously run in the QB.EXE environment.
Microsoft has confirmed this to be a bug with QB.EXE in QuickBasic versions 4.0b and 4.5, and with QB.EXE in Microsoft Basic Compiler versions 6.0 and 6.0b for MS-DOS (buglist6.00 buglist6.00b). This problem was corrected in Microsoft Basic Professional Development System (PDS) version 7.0 (fixlist7.00).
The following related problem occurs in both QB.EXE and compiled .EXE programs: after CALL SETUEVENT is invoked just once, each subsequent non-user-defined event (such as ON TIMER, ON COM, ON KEY, or ON PLAY) also improperly activates the user-defined event (ON UEVENT GOSUB) trap. For more information on this related problem, query on the following words:
SETUEVENT and buglist4.50
Steps to Reproduce Problem in QB.EXE
The following program, EVENT1.BAS, sets up a user-defined event trap but never activates it. The second program, EVENT2.BAS, sets up and activates another user-defined event trap.
The first time EVENT1.BAS is run in QB.EXE, the user-defined event trap never occurs (which is correct). If it is run after EVENT2.BAS, the EVENT1 procedure is activated. This is because the SETUEVENT is remembered between the programs.
The steps to reproduce this are as follows:
- Invoke QB.EXE.
- Load EVENT1.BAS (it runs correctly).
- Load EVENT2.BAS and run it.
- Load EVENT1.BAS again. User event remembers TIMER event.
CLS ON UEVENT GOSUB event1 UEVENT ON DO: LOOP UNTIL INKEY$ <> "" END event1: PRINT "user event" RETURN
'**** PROGRAM #2 CLS ON UEVENT GOSUB event1 ON TIMER(1) GOSUB timeout UEVENT ON TIMER ON CALL setuevent DO: LOOP UNTIL INKEY$ <> "" END
PRINT "timeout" RETURN
PRINT "user event" RETURN
Additional query words: QuickBas BasicCom 4.00b 4.50 6.00 6.00b 7.00 buglist4.00b buglist4.50 B_BasicCom