4个回答
展开全部
'所需窗体及控件 Form1,Timer1,Command1
Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Const VK_Ctrl = 17
Const VK_V = 86
Const VK_Enter = 13
Const KEYEVENTF_KEYUP = &H2
Private Sub Form_Load()
Timer1.Interval = 3000
Timer1.Enabled = False
End Sub
Private Sub Command1_Click()
If Timer1.Enabled Then
Timer1.Enabled = False
Else
Timer1.Enabled = True
End If
End Sub
Private Sub Timer1_Timer()
keybd_event VK_Ctrl, 0, 0, 0 ' press Ctrl
keybd_event VK_V, 0, 0, 0 ' press V
keybd_event VK_V, 0, &H2, 0 ' release V
keybd_event VK_Ctrl, 0, &H2, 0 ' release Ctrl
keybd_event VK_Enter, 0, 0, 0 ' press Enter
keybd_event VK_Enter, 0, &H2, 0 ' release Enter
End Sub
Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Const VK_Ctrl = 17
Const VK_V = 86
Const VK_Enter = 13
Const KEYEVENTF_KEYUP = &H2
Private Sub Form_Load()
Timer1.Interval = 3000
Timer1.Enabled = False
End Sub
Private Sub Command1_Click()
If Timer1.Enabled Then
Timer1.Enabled = False
Else
Timer1.Enabled = True
End If
End Sub
Private Sub Timer1_Timer()
keybd_event VK_Ctrl, 0, 0, 0 ' press Ctrl
keybd_event VK_V, 0, 0, 0 ' press V
keybd_event VK_V, 0, &H2, 0 ' release V
keybd_event VK_Ctrl, 0, &H2, 0 ' release Ctrl
keybd_event VK_Enter, 0, 0, 0 ' press Enter
keybd_event VK_Enter, 0, &H2, 0 ' release Enter
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Option Explicit
Private Sub Command1_Click()
Timer1.Enabled = True
Timer1.Interval = 5000
End Sub
Private Sub Timer1_Timer()
SendKeys "^v", True
SendKeys "{ENTER}", True
End Sub
'怎么用VB编辑一个3秒重复Ctrl+V然后再按Enter的动作?
'上面这段程序是5秒按一下Ctrl+V然后再按Enter的动作,前题是你得有对应的窗口接收,并且为为活动窗口。比如 你先打开一个word,然后运行程序,再点一下word
Private Sub Command1_Click()
Timer1.Enabled = True
Timer1.Interval = 5000
End Sub
Private Sub Timer1_Timer()
SendKeys "^v", True
SendKeys "{ENTER}", True
End Sub
'怎么用VB编辑一个3秒重复Ctrl+V然后再按Enter的动作?
'上面这段程序是5秒按一下Ctrl+V然后再按Enter的动作,前题是你得有对应的窗口接收,并且为为活动窗口。比如 你先打开一个word,然后运行程序,再点一下word
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
需要有两个知识点来完成,
1.vb的sendkey方法。
2.timer控件
在form的load时间内设置timer的时间周期Interval = 3000(毫秒为单位)
然后写意个timer里面放入sendkey功能
如下
Private Sub Timer1_Timer()
SendKeys "{17}"
End Sub
Private Sub Timer1_Timer()
SendKeys "{86}"
End Sub
Private Sub Timer1_Timer()
SendKeys "{enter}"
End Sub
1.vb的sendkey方法。
2.timer控件
在form的load时间内设置timer的时间周期Interval = 3000(毫秒为单位)
然后写意个timer里面放入sendkey功能
如下
Private Sub Timer1_Timer()
SendKeys "{17}"
End Sub
Private Sub Timer1_Timer()
SendKeys "{86}"
End Sub
Private Sub Timer1_Timer()
SendKeys "{enter}"
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
可以用SENDKEY
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询