易语言的连点器源码
时间: 2023-07-28 17:06:43 浏览: 160
以下是一个简单的易语言连点器的源码:
```
' 连点器
' by: 自由飞翔的燕子
' Date: 2019/6/5
' 全局变量
Global hMain, hEdit, hButton, hTimer As Long
Global delay As Integer
' 窗口消息回调函数
Function WinProc(hWnd As Long, uMsg As Long, wParam As Long, lParam As Long) As Long
' 处理定时器消息
If uMsg = WM_TIMER Then
' 发送鼠标左键按下和弹起消息
SendMessage hMain, WM_LBUTTONDOWN, MK_LBUTTON, MakeLParam(10, 10)
SendMessage hMain, WM_LBUTTONUP, 0, MakeLParam(10, 10)
' 延时指定的时间
Sleep delay
End If
' 处理窗口关闭消息
If uMsg = WM_DESTROY Then
' 销毁定时器
KillTimer hMain, hTimer
' 退出程序
PostQuitMessage 0
End If
' 默认消息处理
WinProc = DefWindowProc(hWnd, uMsg, wParam, lParam)
End Function
' 主函数
Function Main()
' 创建窗口
hMain = CreateWindow("STATIC", "", 0, 0, 0, 0, 0, 0, 0, hInstance, 0)
' 创建编辑框
hEdit = CreateWindow("EDIT", "", WS_CHILD Or WS_VISIBLE Or ES_NUMBER, 10, 10, 100, 20, hMain, 0, hInstance, 0)
' 创建按钮
hButton = CreateWindow("BUTTON", "开始连点", WS_CHILD Or WS_VISIBLE, 120, 10, 100, 20, hMain, 0, hInstance, 0)
' 注册窗口消息回调函数
SetWindowLong hMain, GWL_WNDPROC, AddressOf WinProc
' 显示窗口
ShowWindow hMain, SW_SHOWDEFAULT
' 消息循环
Dim msg As MSG
While GetMessage(msg, 0, 0, 0)
TranslateMessage msg
DispatchMessage msg
Wend
End Function
' 开始按钮点击事件
Sub Button_Click()
' 获取延时时间
delay = Val(GetWindowText(hEdit))
' 创建定时器
hTimer = SetTimer(hMain, 0, 10, 0)
End Sub
```
该连点器使用了一个定时器,每隔一定时间自动发送鼠标左键按下和弹起消息,实现连点的效果。用户可以通过编辑框设置延时时间,以控制连点速度。
阅读全文