怎么让程序执行↓键(在线等,急)
发布网友
发布时间:2022-04-26 12:38
我来回答
共2个回答
热心网友
时间:2022-06-28 08:01
Option Explicit
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal Scan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Sub Command1_Click()
keybd_event vbKeyDown, 0, 0, 0 '按下↓键
keybd_event vbKeyDown, 0, 2, 0 '释放↓键
End Sub
热心网友
时间:2022-06-28 08:01
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 MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" (ByVal wCode As Long, ByVal wMapType As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
keybd_event vbKeyDown, MapVirtualKey(vbKeyDown, 0), 0, 0
Call Sleep(20)
keybd_event vbKeyDown, MapVirtualKey(vbKeyDown, 0), 2, 0
End Sub