Timer Event Suspended While Menu Is Dropped Down

ID: Q90901


The information in this article applies to:
  • Microsoft Visual Basic Standard and Professional Editions for MS-DOS, version 1.0


SUMMARY

The events triggered by the timer control are suspended while a menu is dropped, or if there is a message box or input box on the screen.

This behavior differs from that of Microsoft Visual Basic for Windows, version 1.0.


MORE INFORMATION

In applications where it is critical that the timer interval be monitored as closely as possible, you may need to avoid menus and message boxes. If possible, when monitoring hardware or communication lines with the timer event, communications or data flow should be suspended while showing a message box or pulling down a menu.

One technique that will help in many cases with menus is to use the top-level menu click to suspend communication or stop flow of data. See the section titled "Code in Top-Level Menu Click Procedures" in the chapter titled "Creating Menus" of the Visual Basic "Programmer's Guide" for guidelines on what type of code can be added to a top-level menu Click event.

The following code will demonstrate the difference:

Example

To try this example in VBDOS.EXE:

  1. From the File menu, choose New Project.


  2. From the File menu, choose New Form.


  3. Add a timer control (Timer1) to the form.


  4. Create a top-level menu with at least one submenu.


  5. Exit FD.EXE and return to VBDOS.EXE.


  6. Add the following code to the appropriate event procedures:
    
            SUB Form_Click()
                    Timer1.Interval = 10
                    Timer1.Enabled = -1
            END SUB
    
            SUB timer1_timer()
                    BEEP
            END SUB 


  7. Press F5 to run the program.


  8. Click on the form; the beeping will start.


  9. Select the menu. When it opens, the beeping will stop.


  10. Close the menu; the beeping resumes.


Additional query words: VBmsdos 1.00

Keywords :
Version : MS-DOS:1.0
Platform : MS-DOS
Issue type :


Last Reviewed: December 10, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.