The problem with your approach that you have to insert your function in each method and function, which is called in the process.
I have an idea in mind, but haven't tested it yet or thought in all details.
ON ESCAPE Error SomeCustomNumber
Error method of the form will check for this error number and return to what? Will return to master stop the process?
You see, this is just an idea. I'm afraid, that there is no universal solution, and it's too bad. For instance, today I was testing something. One of the processos was FTP file to User's site. Since I didn't have an ability to stop the process, I uploaded some test data to the customer's site. Well, let's hope they were already processed, so this would not cause any problems...
>>Can we have one universal approach? E.g. I don't want to put multiple checks in the form's code.
>>
>>I have a Distribution form. This form runs several processes, I want to be able to stop them in any time.
>
>I undestand that this is desirable, but I don't think a universal solution (like "SET ESCAPE ON") is possible, or practical. For instance, different cleanup code might have to be run, depending on where the user interrupts.
>
>You might try a universal solution, with SET ESCAPE, or with a timer.
>
>In my own code, I use the not-so-universal solution of having a function, User_Interrupt(), that checks for a certain key being pressed. Then, a typical scan loop might look as follows:
>
>
>local llInterrupted
>scan
> * Do some processing with the selected record
> if User_Interrupt()
> llInterrupted = .T.
> exit
> endif
>endscan
>if llInterrupted
> ...
>endif
>
>
>The function User_Interrupt itself is very simple; the main commands are a) inkey(), and b) clear typeahead.
>
>Hilmar.
If it's not broken, fix it until it is.
My Blog