Mr. Mike show very good ways:

There are plenty of ways you can do this.

The simplest would be to create a form property, lStop, which is set to .T.
in the stop button's Click()

Then, in your loop, you will need to call DoEvents() once in a while. This
will let the UI events happen, so your code can check to see if lStop has
been set to .T. 

If it has, you can end your loop.


Another way would be to use two programs

1. a UI-less EXE that performs your loop.
2. a UI that creates and deletes a file on disk

When the UI application starts, it should create the file, and launch the
UI-less app.

When the stop button is clicked on the UI application, it should delete the
file.

The loop can do something like this:


do while .t.
   if file("myservice.txt")
       *** Code to open DBF, look for records, and process
   else
       exit
   endif
enddo
So if myservice.txt exists, the loop keeps running. If it gets deleted, the
loop stops.

One benefit of this method is that the loop can be terminated by deleting a
file from Windows explorer, if all else fails.
Cloud Music Company

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Ali İhsan Türkoğlu
Sent: Friday, January 05, 2007 6:13 PM
To: [EMAIL PROTECTED]
Subject: Escape from Infinite loop

I should write a VFP program that work on server. Continuously, This program
will look a vfp table, if new records added, make some jobs.

User should start and stop this program.

Question is: How can I escape from an endless loop, when user clicks the
stop buton on my vfp form?

 

Is this type program consume much CPU time due to endless do while loop?

 

Thanks for all help.

 

Ali Ihsan



--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---


[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to