Microsoft KB Archive/129839

= PRB: Windows 95/98 Ignores ALT+TAB from SendKeys in VB =

Article ID: 129839

Article Last Modified on 6/12/2001

-

APPLIES TO


 * Microsoft Visual Basic 4.0 Standard Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 16-bit Enterprise Edition
 * Microsoft Visual Basic 4.0 32-Bit Enterprise Edition
 * Microsoft Visual Basic 2.0 Standard Edition
 * Microsoft Visual Basic 3.0 Professional Edition
 * Microsoft Visual Basic 2.0 Professional Edition
 * Microsoft Visual Basic 3.0 Professional Edition
 * Microsoft Visual Basic 1.0 Standard Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q129839



SYMPTOMS
A Visual Basic application running under Windows 95 or Windows 98 is unable to use SendKeys to send an ALT+TAB key sequence to the operating system. The application can use SendKeys to send an ALT+TAB key sequence to the operating system when the application is running under Windows version 3.x, Windows for Workgroups, Windows NT, or Windows 2000.

Windows 95 and Windows 98 ignore the ALT+TAB key sequence sent by the Visual Basic application.



CAUSE
Windows 95 and Windows 98 handle the processing of the ALT+TAB key sequence differently. When you press the ALT+TAB key sequence, Windows 95 and Windows 98 handles it immediately rather than placing it in the message queue as Windows 3.x, Windows for Workgroups, Windows NT, and Windows 2000 do. Therefore, placing the ALT+TAB sequence in the message queue by using SendKeys does not produce the desired behavior.



RESOLUTION
Modify any application that programmatically sends an ALT+TAB key sequence to the Windows 95 or Windows 98 operating systems.

NOTE: Using the ALT+TAB keystroke sequence to make an application active is not recommended by Microsoft under any operating system. In Visual Basic, use the AppActivate statement instead.



STATUS
This behavior is by design. It is not a problem with Visual Basic. It is a difference in the behavior of Windows 95 and Windows 98. By design, Windows 95 and Windows 98 handle the ALT+TAB keystroke sequence differently.



Steps to Reproduce the Behavior
 Start Visual Basic. From the File menu, choose New Project.  Enter the following code into the Form's Click event procedure: Private Sun Form_Click ' Send ALT+TAB to Windows 95 SendKeys "%{TAB}", True Debug.Print "ALT+TAB Sent" End Sub  Press the F5 key to run the application. Click the form.</li></ol>

At this point, "ALT+TAB Sent" is displayed in the Debug Window (if the Debug Window is visible) but nothing else appears to happen. This behavior is by design in Windows 95 and Windows 98.

Under Windows 3.x, Windows for Workgroups, Windows NT, or Windows 2000 "ALT+TAB Sent" is displayed in the Debug Window (if the Debug Window is visible, and an application's title appears in the center of the screen and then disappears when that application becomes active.

Additional query words: Alt Tab Send Win95 Win98 kbdsd

Keywords: kbprb KB129839

-

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

© Microsoft Corporation. All rights reserved.