Microsoft KB Archive/96099

= How to Drop Down a Menu on the Startup Form of an Application =

PSS ID Number: 96099

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 Q96099



SUMMARY
Using a BIOS function to push a character into the keyboard type-ahead buffer, a menu can be dropped down on the startup form of a Visual Basic application on IBM AT and PS/2 class computers by using the Call Interrupt statement. This technique will not work on IBM PC class computers.

By pushing into the keyboard buffer the scancode of the access key for the menu you want to drop, you can show the menu dropped down when the form becomes visible. To push the scancode, call BIOS Interrupt &H16, Function 5 in the Form_Load event of the startup form. This technique may not work from procedures other than the Form_Load event because it works only if this interrupt is called prior to a situation where VB-DOS is going to check the keyboard buffer.



MORE INFORMATION
Here is a table of scancodes for access keys and an example showing how to push the scancodes into the keyboard buffer.

Table of access key scancodes: Letter Scancode       Letter  Scancode        Letter  Scancode --- A      30             J        36             S       31 B      48             K        37             T       20 C      46             L        38             U       22 D      32             M        50             V       47 E      18             N        49             W       17 F      33             O        24             X       45 G      34             P        25             Y       21 H      35             Q        16             Z       44 I      23             R        19

Step-by-Step Example
  Start VBDOS.EXE with the VBDOS.QLB quick library: VBDOS /l.  From the File menu, choose New Form (ALT, F, F). Form1 is created by default. From the Window menu, choose Menu Design Window (ALT, W, M).  Create a top level menu with the following properties: Caption = &File CtlName = mFile   Create a menu item under &File with the following properties: Caption = &Exit CtlName = mFileExit  Press the Done button (ALT+D) to close the Menu Design Window.</li> From the File menu, choose Exit (ALT, F, X). Save all changes.</li>  Add the following code to Form1's module level code: Rem $INCLUDE: 'VBDOS.BI' </li>  Add the following code to the Form_Load event procedure: Sub Form_Load Dim r AS RegType r.ax = &H500       ' function to push character r.cx = &H100 * 33  ' scan code for ALT + 'F'         Call Interrupt(&H16, r, r)      End Sub </li> From the Run menu, choose Start (ALT, R, S) to run the program.</li></ol>

Form1 is loaded and shown with the top level menu with File dropped down.

Additional query words: VBmsdos 1.00

Keywords: KB96099

Technology: kbAudDeveloper kbVB100DOS kbVBSearch kbZNotKeyword3

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© 2004 Microsoft Corporation. All rights reserved.