⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 module1.bas

📁 单片机通过串口协议控制电脑鼠标移动 A program that communicate with MCU through RS232 to let the MCU control the mous
💻 BAS
字号:
Attribute VB_Name = "Module1"
Public Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

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)
Public Type POINTAPI
        x As Long
        y As Long
End Type

Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Public Const MOUSEEVENTF_LEFTDOWN = &H2
Public Const MOUSEEVENTF_LEFTUP = &H4
Public Const MOUSEEVENTF_RIGHTDOWN = &H8
Public Const MOUSEEVENTF_RIGHTUP = &H10

Function LeftC(x As Long, y As Long)
mouse_event MOUSEEVENTF_LEFTDOWN, x, y, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, x, y, 0, 0
End Function

Function RightC(x As Long, y As Long)
mouse_event MOUSEEVENTF_RIGHTDOWN, x, y, 0, 0
mouse_event MOUSEEVENTF_RIGHTUP, x, y, 0, 0
End Function

Function DblC(x As Long, y As Long)
mouse_event MOUSEEVENTF_LEFTDOWN, x, y, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, x, y, 0, 0



mouse_event MOUSEEVENTF_LEFTDOWN, x, y, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, x, y, 0, 0
End Function


Function LeftDown(x As Long, y As Long)
mouse_event MOUSEEVENTF_LEFTDOWN, x, y, 0, 0
End Function

Function LeftUp(x As Long, y As Long)
mouse_event MOUSEEVENTF_LEFTUP, x, y, 0, 0
End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -