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
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
TimerS.Interval = 100
TimerS.Enabled = 0
TimerS.OnTimer = TimerOver
Form.SHOWMODAL
SUB CheckBox1Click (Sender AS QCHECKBOX)
ok = ok*-1
IF ok=-1 THEN
TimerS.Enabled = 0
Stopmouse
ELSE
TimerS.Enabled = 1
MoveMouse
END IF
END SUB
SUB MoveMouse
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
|