>>>I fully agree with you.
>>>I am doing it the same way as you, except that I missed the DoEvents with that it works fine. A little drawback: DoEvents penalizes the speed. Meanwhile have found an article in Wikis "Fast Do Events" by David Frankenbach, that seems to solve that as well. Will investigate.
>>>
>>
>>The article is irrelevant for VFP9. In VFP9 DoEvents does not wait for a Windows event by default.
>Hi,
>
>Yes I noticed, at least I cannot find any significant speed improvement in this case - 'intercept' a scan...endscan. So must live with this slower performance issue.
>
>Thanks for confirming.
>
>Koen
You can reduce the penalty a little bit by doing what Rick suggested -- execute the DoEvents only occasionally. For example you can have something like:
nLoopCnt = 0
SCAN
.
.
.
nLoopCnt = ( m.nLoopCnt + 1 ) % 10
IF m.nLoopCnt=0 THEN
DOEVENTS
IF m.nStopFlag THEN
EXIT
ENDIF
ENDIF
.
.
.
ENDSCAN
This isn't too different from how we'd handled situation in FPD and FPW where INKEY() was being used. To get mouse clicks to get detected propery we'd discovered we needed to add parameter that specifies a fraction of a second for a "time window" -- but that meant we were taking a "hit" from it in each loop iteration. The solution was to only fire the INKEY() occasionally.