>VFP9SP2
>I would like to conditionaly stop a scan. The easiest way would be to {set escape on} and invoke the ESC key. However the application rules that 'settings' should not be used. Do we have an other option?
Launch a separate process which presents a form with a "Cancel operation" button. Use BindEvent() to send messages back and forth to each other's HWND. Every 10th or 100th iteration on your SCAN, do a DOEVENTS (or DOEVENTS FORCE). Pass the HWND value of your first form as a command line parameter to the called process. It will use BindEvent() on custom messages you'll send from the first/master process. The first thing it does after loading is send a message back saying "I'm up and running," and then you can have two way communication. When your SCAN..ENDSCAN block completes, send it the terminate message to close the separate process. If the user clicks the "Cancel operation" button, send your SCAN..ENDSCAN process the "the user wants to cease" operation.
You can see a sample of how this works:
https://github.com/RickCHodgin/guithreadTo run, go to the "master" directory and type "do go".