DECLARE FUNCTION GetAsyncKeyState LIB "user32" ALIAS _
"GetAsyncKeyState" (vKey AS LONG) AS INTEGER
DECLARE SUB scanmouse
DIM scan AS QTIMER
scan.ontimer=scanmouse
scan.interval=100
CREATE Form AS QFORM
CREATE s AS QEDIT
text="Drag me!"
END CREATE
END CREATE
Form.SHOWMODAL
SUB scanmouse
IF getasynckeystate(1)<>0 THEN
screen.cursor=-12
DIM oldx AS SHORT,oldy AS SHORT
DIM oldleft AS SHORT,oldtop AS SHORT
oldx=screen.MOUSEX:oldy=screen.MOUSEY
oldleft=s.left:oldtop=s.top
WHILE getasynckeystate(1)<>0
s.left=oldleft+screen.MOUSEX-oldx
s.top=oldtop+screen.MOUSEY-oldy
WEND
screen.cursor=0
END IF
END SUB
|