Guidance
指路人
g.yi.org
software / rapidq / Examples / Devices / mouse / MoveMouse.bas

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
' This could be a good trick for cash bars...
' Make your mouse move on the screen
' by Jean CARTIER

     DECLARE SUB CheckBox1Click (Sender AS QCHECKBOX)
     DECLARE SUB mouse_event LIB "user32" ALIAS "mouse_event"(BYVAL dwFlags AS LONG, BYVAL dx AS LONG, BYVAL dy AS LONG, BYVAL cButtons AS LONG, BYVAL dwExtraInfo AS LONG)
     DECLARE SUB MoveMouse
     DECLARE SUB StopMouse

     CONST MOUSEEVENTF_MOVE = &H1

     DIM TimerS AS QTIMER

'Test if button is checked (1) or not (-1)
     ok = -1

     SUB TimerOver
      TimerS.Interval = 100
      MoveMouse
     END SUB

     CREATE Form AS QFORM
      CAPTION = "Tremblez"
      Width = 64
      Height = 64
      Center
      CREATE CheckBox1 AS QCHECKBOX
       CAPTION = "Activer"
       Left = 10
       Top = 10
       Width = 60
       OnClick = CheckBox1Click
      END CREATE
     END CREATE

'Insert your initialization code here
     TimerS.Interval = 100
     TimerS.Enabled = 0 ' True
     TimerS.OnTimer = TimerOver

     Form.SHOWMODAL

'--------- Subroutines ---------

     SUB CheckBox1Click (Sender AS QCHECKBOX)
      ok = ok*-1
      IF ok=-1 THEN
       TimerS.Enabled = 0 ' True
       Stopmouse
      ELSE
       TimerS.Enabled = 1 ' True
       MoveMouse
      END IF
     END SUB

     SUB MoveMouse
'Random move
      IF RND(10)>4 THEN
       signX = -1
      ELSE
       signX = 1
      END IF
      IF RND(10)>4 THEN
       signY = -1
      ELSE
       signY = 1
      END IF
      mouse_event(MOUSEEVENTF_MOVE, signX*RND(10), signY*RND(10), cButt, dwEI)
     END SUB

     SUB StopMouse
      mouse_event(MOUSEEVENTF_MOVE, 0, 0, cButt, dwEI)
     END SUB

掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Thu 2023-2-2  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2002-06-09 08:57:34