>
> Hi everyone.
>
> I would like to know how to create a button similar to 'Stop Search' in Windows 2000 under Start ... Search ... For Files or Folders ...
>
> At the moment when I run some batch program which skips through large tables processing information the only way I can stop it is to hit ESC.
>
> This is obviously not ideal as sometimes information is either not saved or corrupted in some way.
>
> I would like a 'Stop Processing' button which is enabled when the batch program begins and which would stop the batch program processing when it is clicked.
>
> Thanks in advance.
>
> Russell.
>
You're looking for DOEVENTS. This sample code code should get you started.
loForm = CREATEOBJECT("frmBusy")
loForm.show()
loForm.BeVeryBusy()
DEFINE CLASS frmBusy AS Form
width = 200
height = 90
autocenter = .t.
caption = "Very busy form"
l_proceed = .T.
n_count = 0
ADD OBJECT "Label1" as Label WITH ;
caption = "", ;
left = 10, ;
top = 20, ;
width = 130 ;
ADD OBJECT "Button1" as CommandButton WITH ;
caption = "\<Cancel", ;
cancel = .T., ;
left = 10, ;
autosize = .T., ;
top = 40
PROCEDURE BeVeryBusy
DO WHILE this.l_proceed
this.n_count = this.n_count + 1
this.label1.caption = "Counting...: " + TRANSFORM(this.n_count)
DOEVENTS
ENDDO
ENDPROC
PROCEDURE Button1.Click
IF MESSAGEBOX("Cancel this process?", 36, _screen.Caption) = 6
thisform.l_proceed = .F.
ENDIF
ENDPROC
ENDDEFINE
Now, you might want to give this a read too:
FIX: DOEVENTS Command Runs Slowly
http://support.microsoft.com/default.aspx?scid=kb;en-us;268771--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts