VB像按键精灵一样输出文字
如何启动生成的EXE后自动在指定坐标输入指定文字,鼠标坐标时间都设置好了,问题是输入指定文字的事件是键盘事件吗,要怎么声明?要怎么写才能全局都可以调用PrivateDec...
如何启动生成的EXE后自动在指定坐标输入指定文字,鼠标坐标时间都设置好了,问题是输入指定文字的事件是键盘事件吗,要怎么声明?要怎么写才能全局都可以调用
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
Option Explicit
Private Sub Command1_Click()
SetCursorPos 470, 1069
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 '鼠标按下
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 '鼠标弹起
Timer1.Interval = 500 '等待1000毫秒(1秒)
Timer1.Enabled = True '启动定时器
Do While Timer1.Enabled '循环等待,直到定时器Timer1停止
DoEvents '等待期间防止窗体“凝滞”
Loop
SetCursorPos 1846, 142
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 '鼠标按下
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 '鼠标弹起
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 '鼠标按下
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 '鼠标弹起
Timer1.Interval = 500 '等待1000毫秒(1秒)
Timer1.Enabled = True '启动定时器
Do While Timer1.Enabled '循环等待,直到定时器Timer1停止
DoEvents '等待期间防止窗体“凝滞”
Loop 展开
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
Option Explicit
Private Sub Command1_Click()
SetCursorPos 470, 1069
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 '鼠标按下
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 '鼠标弹起
Timer1.Interval = 500 '等待1000毫秒(1秒)
Timer1.Enabled = True '启动定时器
Do While Timer1.Enabled '循环等待,直到定时器Timer1停止
DoEvents '等待期间防止窗体“凝滞”
Loop
SetCursorPos 1846, 142
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 '鼠标按下
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 '鼠标弹起
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 '鼠标按下
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 '鼠标弹起
Timer1.Interval = 500 '等待1000毫秒(1秒)
Timer1.Enabled = True '启动定时器
Do While Timer1.Enabled '循环等待,直到定时器Timer1停止
DoEvents '等待期间防止窗体“凝滞”
Loop 展开
2个回答
展开全部
用插件就完了 别搞麻烦了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询