Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Running a method in the back ground...
Message
 
 
To
04/12/2000 09:23:36
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00448753
Message ID:
00448761
Views:
8
>I would like to run a form that also has another method or piece of code running independently in the back ground. The form would function as it normally does but it has this other code doing sometime else at the same time. The user would not even know this other piece of code is running and it would continue to execute until the form is released. How can this be done?

Use a timer object. When your form is first instantiated, create a timer object and assign it to a form property so it lives as long as the form. If you want the code to run repeatedly, then set the the timer interval appropriately and have the timer event call your function.

Having said that, you may or may not get the results you want. While the timer will fire independently of your user, the function that it calls may not fire exactly when it should. If your user is running some code that does not have any wait states built into it, then that code will run to its completion. The timer events will build up until a wait state is reached. The same is true if the code the timer event calls does not execute in the interval specified.

If your interval is large enough, this should not present a problem. However, if your interval is very short, then you could have major problems. See a thread started by Mal Shiroma last week about what happened to him and what he did to correct the problem. See Thread 447225.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform