Microsoft KB Archive/43023

From BetaArchive Wiki

Article ID: 43023

Article Last Modified on 11/21/2006

This article was previously published under Q43023

SYMPTOMS

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.

STATUS

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).

MORE INFORMATION

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:

  1. Invoke QB.EXE.
  2. Load EVENT1.BAS (it runs correctly).
  3. Load EVENT2.BAS and run it.
  4. Load EVENT1.BAS again. User event remembers TIMER event.

EVENT1.BAS

CLS
ON UEVENT GOSUB event1
UEVENT ON
DO: LOOP UNTIL INKEY$ <> ""
END

event1:
 PRINT "user event"
 RETURN
                

EVENT2.BAS

'**** PROGRAM #2
CLS
ON UEVENT GOSUB event1
ON TIMER(1) GOSUB timeout
UEVENT ON
TIMER ON
CALL setuevent
DO: LOOP UNTIL INKEY$ <> ""
END
                

timeout:

  PRINT "timeout"
RETURN
                

event1:

  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

Keywords: KB43023