Microsoft KB Archive/92770

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 10:25, 21 July 2020 by X010 (talk | contribs) (Text replacement - ">" to ">")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Base


Use of ON TIMER In Overlays Can Cause EXE to Exit or Hang

PSS ID Number: 92770

Article Last Modified on 1/8/2003



The information in this article applies to:

  • Microsoft Visual Basic for MS-DOS 1.0



This article was previously published under Q92770

SYMPTOMS

The use of the ON TIMER trapping routine within an overlay of an application can cause that application to either terminate and exit or in some cases to hang.

STATUS

Microsoft has confirmed this to be a bug in the Standard and Professional Editions of Microsoft Visual Basic for MS-DOS, version 1.0. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The application will terminate and exit if the following example is compiled and linked for use with overlays:

  1. Start VBDOS.EXE.
  2. Create 7 separate .BAS files (listed below) that contain the following code:

MAIN.BAS:

    DECLARE SUB sub1 ()
    DECLARE SUB sub2 ()
    DECLARE SUB sub3 ()
    DECLARE SUB sub4 ()
    DECLARE SUB sub5 ()
    DECLARE SUB subinit ()
    CALL subinit
    WHILE 1
        CALL sub1
        CALL sub2
        CALL sub3
        CALL sub4
        CALL sub5
    WEND
                

SUB1.BAS:

    SUB Sub1()
       PRINT "Sub1"
    END SUB
                

SUB2.BAS:

    SUB Sub2()
       PRINT "Sub2"
    END SUB
                

SUB3.BAS:

    SUB Sub3()
       PRINT "Sub3"
    END SUB
                

SUB4.BAS:

    SUB Sub4()
       PRINT "Sub4"
    END SUB
                

SUB5.BAS:

    SUB Sub5()
       PRINT "Sub5"
    END SUB
                

SUBINIT.BAS:

    timeLabel:
         PRINT "In Timer"
         BEEP
         RETURN

    SUB subinit ()
        ON TIMER(1) GOSUB timeLabel
        TIMER ON
        PRINT "SubInit"
    END SUB
                
  1. You should now have 7 separate .BAS files in your Project.
  2. Exit VBDOS.EXE.
  3. Compile each of these modules using BC.EXE with the switches of: /o/v/w/d. For example:

    BC MAIN.BAS /o/v/w/d;

  4. Create a Definition File (TEST.DEF) with the following code in it:

       SEGMENTS
       'sub1_CODE' CLASS 'BC_CODE' ovl:1
       'sub2_CODE' CLASS 'BC_CODE' ovl:2
       'sub3_CODE' CLASS 'BC_CODE' ovl:3
       'sub4_CODE' CLASS 'BC_CODE' ovl:4
       'sub5_CODE' CLASS 'BC_CODE' ovl:5
       'subinit_CODE' CLASS 'BC_CODE' ovl:6
                            
  5. LINK all the modules together using overlays and create TEST.EXE. For example:

       c:\> LINK main sub1 sub2 sub3 sub4 sub5 subinit, test.exe,,
                 vbdcl10e,test.def;
       (NOTE: The LINK line above should appear on one line.)
                            
  6. Run the application TEST.EXE and it will eventually exit out.

The application runs fine if compiled without overlays or if run in the interpreter (VBDOS.EXE).

To work around this problem use the Timer control on a form and put the timeLabel: code into the Timer event procedure for the Timer control.


Additional query words: VBmsdos buglist1.00 1.00

Keywords: KB92770
Technology: kbAudDeveloper kbVB100DOS kbVBSearch kbZNotKeyword3