Title | Simulate Alt-Tab in Visual Basic 6 |
Description | This example shows how to simulate Alt-Tab in Visual Basic 6. That moves focus to the next application running. |
Keywords | Alt-Tab, simulate, Visual Basic 6, keyboard, keybd_event |
Categories | Miscellany, Software Engineering, API |
|
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As _
Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal _
dwExtraInfo As Long)
Private Const KEYEVENTF_KEYUP = &H2
Private Const VK_ALT = &H12
Private Const VK_TAB = &H9
' Grab all of the text in the WebBrowser control.
Private Sub Command1_Click()
' Press Alt.
keybd_event VK_ALT, 0, 0, 0
DoEvents
' Press Tab.
keybd_event VK_TAB, 1, 0, 0
DoEvents
' Release Alt.
keybd_event VK_ALT, 0, KEYEVENTF_KEYUP, 0
DoEvents
End Sub
|