实际上不必用费劲的常数,模拟按键都是PostMessage
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
Private Const WM_KEYDOWN = &H100
Private Const WM_KEYUP = &H101
Private Sub Command1_Click()
Dim a As Long
a = FindWindow(vbNullString, Text1.Text)
PostMessage a, WM_KEYDOWN, vbKeyReturn, 0
End Sub
keybd_event也可以用这种方法
TAB键与回车键都是按键.
既然能够发送TAB(VK_TAB)键.为何转个弯了想呢? 不会是复制的吧