>Charlie,
>Thanks for your advice. I am really trying to get a command button to stop a long series of routines from finishing, similar to the 'Phone dialer' in Windows. I know that the 'Escape' key will stop code from running. I have created a form with two command buttons ('RUN' and 'STOP') and a timer. I have set the timer Interval to 1/1000 of a second and a Wait Window with a Timeout of 5 seconds in the timer event. While the Timer is firing I can not click on the 'STOP' button to interrupt the Wait Window (the Wait Window simulates code running). Any advice?
In any looping code or anything like that, I do this:
LOCAL obtn, ncnt, x
obtn = thisform.cmdStopButn
ncnt = 0
DO WHILE .t.
x = SYS(1270)
IF MDOWN() AND TYPE('x')='O' AND obtn.Name=x.Name
thisform.StopMe = .t.
DOEVENTS
ENDIF
IF thisform.StopMe
EXIT
ENDIF
ncnt = ncnt + 1
WAIT WINDOW NOWAIT 'Run Away '+TRANSFORM(ncnt,'')+'!!!!!'
ENDDO
Note that the cmdStopButn has in it's click method code to set the form property StopMe to .T.. The DOEVENTS lets the click from the button take effect (setting the StopMe property) and then the check bails out of the loop.