Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Exit an ongoing scan
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00597144
Message ID:
00597173
Views:
18
>Hi Evan!
>
>Thanks for your quick reply. You suggestion works! But how come it significantly slows down the speed of the scanning? And why is it that when i move my mouse on the form, it somehow "speeds up"? Weird eh?

Charles,

The DoEvents causes Fox to stop doing the scan and read the windows event stack to see if it needs to do anything. Moving the mouse puts an event on the stack so fox gets a reply and moves on without waiting for a timeout. Thw way to make this all come together for you is this;
LOCAL lnCounter
lnCounter = 0

PRIVATE llDone
llDone = .F.

SCAN FOR Whatever
   ...
   lnCounter = lnCounter + 1
   IF MOD(lnCounter,100) = 0
      DoEvents
      IF llDone
        EXIT
      ENDIF
   ENDIF
ENDSCAN
Have your cancel button make llDone .T.

Thid appraoch will only call DoEvents every 100th time through the loop. It will cause some short delay in responsiveness to the user but it won't slow your loop down anywhere near as much.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform