切换到宽版
  • 2820Read
  • 0Replay

VB 控制鼠标位置 [复制链接]

上一主题 下一主题
离线Francis
 

只看楼主 倒序阅读 使用道具 楼主  posttime: 2015-12-17
Dim x As Integer
Dim y As Integer

Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long

Private Sub Command1_Click()
        Dim PID As Long
        
        GetWindowThreadProcessId Me.hwnd, PID
        
        MsgBox "窗口进程的ID是:" & PID
End Sub

Private Sub Timer1_Timer()

        Dim WindowHandle As Long
        
        Randomize
        x = Rnd() * 100
        y = Rnd() * 100
        
        WindowHandle = SetCursorPos(x, y)
        
End Sub
快速回复
限100 字节
如果您在写长篇帖子又不马上发表,建议存为草稿
 
上一个 下一个