08-14-2007, 07:06 AM
WaitForMouseMove
WaitForMouseStop
;/;
function# [double'maxWaitTime]
;Waits until mouse movement begins.
;Returns 1 if movement began, 0 if not.
;maxWaitTime - number of seconds to wait. Default or 0 - infinite.
int wt=maxWaitTime*1000
int t1=GetTickCount
POINT p p0
xm p0
rep
,0.05
,xm p
,if(memcmp(&p &p0 sizeof(POINT))) ret 1
,if(wt and GetTickCount-t1>=wt) ret WaitForMouseStop
;/;
function double'idleTime
;Waits until mouse movement ends.
;idleTime - number of seconds mouse must be not moving.
POINT p pp
int i t0 it=idleTime*1000
xm pp
rep
,0.05
,xm p
,if(memcmp(&p &pp sizeof(POINT))) i=0
,else if(!i) i=1; t0=GetTickCount
,else if(GetTickCount-t0>=it) ret
,pp=p