求助!vb帮忙编写一个简单的键盘模拟程序
4个回答
展开全部
经测试,下面的代码通过并正常.
Dim i As Integer
Private Sub Command1_Click()
Timer1.Interval = IIf(Timer1.Interval = 0, 100, 0)
Command1.Caption = IIf(Command1.Caption = "暂停", "开始", "暂停")
End Sub
Private Sub Timer1_Timer()
i = i + 1: If i = 240 Then i = 0
If i Mod 3 = 0 Then SendKeys ("{4 20}")
If i Mod 80 = 0 Then SendKeys ("{tab}")
End Sub
Dim i As Integer
Private Sub Command1_Click()
Timer1.Interval = IIf(Timer1.Interval = 0, 100, 0)
Command1.Caption = IIf(Command1.Caption = "暂停", "开始", "暂停")
End Sub
Private Sub Timer1_Timer()
i = i + 1: If i = 240 Then i = 0
If i Mod 3 = 0 Then SendKeys ("{4 20}")
If i Mod 80 = 0 Then SendKeys ("{tab}")
End Sub
展开全部
使用 api 函数
sendmessage
这个可以控制外部程序
sendmessage
这个可以控制外部程序
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Public Declare Sub keybd_event Lib "user32" Alias "keybd_event" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
模拟键盘按键
模拟键盘按键
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
Static i As Integer
i = i + 1
If i = 3 Then SendKeys ("{4 20}")
If i = 80 Then SendKeys ("{tab}"): i = 0
End Sub
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
Static i As Integer
i = i + 1
If i = 3 Then SendKeys ("{4 20}")
If i = 80 Then SendKeys ("{tab}"): i = 0
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询