Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to execute a background form
Message
From
06/07/2001 07:43:13
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00527251
Message ID:
00527358
Views:
35
Other languages, like Delphi, support Multithreading explicitly. Is there anything planned for future versions of VFP, in this sense?

BTW, another, perhaps primitive, way to use a "background process", is to simply have a separate executable. "run /n mylongprocess.exe"

Hilmar.

>Hi!
>
>It is not call of a form in the timer event. It is organizing of the background process using a timer.
>
>Create a form and make it modeless, not modal. Put a timer control in it. Specify interval 100ms for start, later you will require to tune this value for the best balansing between background process speed and quility of accessing by user other resources of application, like menus or other forms. In the timer event put the processing code, wrapped into the switchng ff timer:
>
>* timer event
>local lnOldInterval
>m.lnOldInterval = this.Interval
>this.Interval = 0
>...
>this.Interval = m.lnOldInterval
>
>Do not use Enabled property of the Timer control to switch off timer in the Timer event. With that approach all pending timer events will fire at once and will be kept in the events queue. This is dangerous becaus if your background process will take more time than 100ms, this queue will grow quickly taking valuable resources and giving user no chanse to do something else but wait while process finished.
>
>Instead of '...' put your background process code that is aware of the previous runs of the timer event. In other words, you require some object or variables or something like that that holds a state of the background process, so next time timer event called you can check the state of previous run and know how to continue. For example, when you process some table content, process one record at one call of the timer event. In such case state will be record pointer in that table. When processing finished, set INterval property of timer to 0 to switch it off. To start process again, clear the data about state of the process and set Interval of the timer to the optimal value again.
>
>HTH.
>
>>Hello.
>>
>>I want to call a form from a timer event, but I want it to be executed as background form so I can access other menus or forms while the background process is running.
>>
>>How can i do this?
>>
>>Thanks.
>>
>>Juan Carlos
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform