Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Escape from Infinite loop
Message
From
08/01/2007 05:14:15
Ali Ihsan Turkoolu
Galaksi Bilgisayar A.Þ.
Ankara, Turkey
 
 
To
05/01/2007 12:17:10
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01182858
Message ID:
01183379
Views:
17
Thank you very much Mike,
I prefer the UI and UIless as an easiest and very usefull way.
I call UIless.exe more than one according to job load.
I learned also what "Doevents" command is.
Ali Ihsan

>>I should write a VFP program that work on server. Continuously, This program will look a vfp table, if new records added, make some time consuming tasks.
>>
>>User should start and stop this program for maintenance purpose.
>>
>>Question is: How can I escape from an endless loop, when user clicks the stop buton on my vfp form?
>
>
>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform