正确例题
'sleep函数
Private Declare Sub Sleep Lib “kernel32” (ByVal dwMilliseconds As Long)
'获取鼠标坐标
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Declare Function GetCursorPos Lib “User32” (lpPoint As POINTAPI) As Long
'移动鼠标
Private Declare Function SetCursorPos Lib “User32” (ByVal X As Long, ByVal Y As Long) As Long
Private Declare Sub mouse_event Lib “User32” (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Private Const MOUSEEVENTF_LEFTDOWN = &H2
Private Const MOUSEEVENTF_LEFTUP = &H4
Private Const MOUSEEVENTF_RIGHTDOWN = &H8
Private Const MOUSEEVENTF_RIGHTUP = &H10
Private Sub Command1_Click()
Text2.Text = Text1.Text
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer) '在form上敲空格触发事件
If KeyAscii = 32 Then '如果按下的是空格键&#x