Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to execute a background form
Message
From
09/07/2001 08:04:39
 
 
To
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:
00528040
Views:
16
Hi!

>Other languages, like Delphi, support Multithreading explicitly. Is there anything planned for future versions of VFP, in this sense?
>

I doubt VFP will be ever multi-threaded. This concept is too low-level and complex as for the most programmers that use VFP, so I doubt MS will see benfit in making in VFP multi-threding support.

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

Yes, but that you require to develop an approach to pass parameters for process and get results of process, that is more complex than just by timer in the same 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
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Reply
Map
View

Click here to load this message in the networking platform