6 people following this project (follow)

MTmyVFP Version 3 - True Foxpro Multi-Threading - Easiest way to multi-thread VFP desktop code.

Use the included class to give your own VFP desktop code real multi-threading capability. Test and use the examples in the included simple form, or, just create and run a thread(s) from the foxpro command window<make sure you're in whatever directory you installed to>:

Simple 3 Steps to create and manage a thread in VFP

1.) oThreadMgr=NEWOBJECT("ThreadManager","threads.fxp")

2.) oThreadMgr.CreateThread("MyThreadFunc","myparameter",[MESSAGEBOX("My thread done!","Result")],[? "processing..."])
Param 1 - your code that will run in a background thread (in this example, MyThreadFunc)
Param 2 (optional) - any parameter you want to pass to your code (can pass multiple parameters separated by commas)
Param 3 (optional) - code that will run when your thread completes
Param 4 (optional) - code that will run in the foreground while your thread is processing (you could possibly add a progress bar here like the one in ctl32progressbar in VFPX)

3.) Other methods of the MT class:
oThreadMgr.SendMsgToStopThreads() - stop the threads
oThreadMgr.SuspendThreads() - pause the threads
oThreadMgr.ResumeThreads() - resume the threads

NOTES:
See comparison with ParallelFox: http://mtmyvfp.codeplex.com/releases/view/50370 which uses parallel vfp processes (EXEs) rather than threads to accomplish parallel processing

Requires VFP 9 (but could probably easily be modified to work in earlier versions). MTmyVFP is written completely in FoxPro and all source code is included.

Calvin Hsia's original source and background info:
http://blogs.msdn.com/calvin_hsia/archive/2006/05/23/605465.aspx

For more elaborate examples of using this class see:
VFPWebCrawler - http://www.codeplex.com/vfpwebcrawler
and
Thread Test by Fernando Bozzo (VFP 8,9)
- http://www.portalfox.com/articulos/archivos/bozzo/Test_Threads.zip

Questions/problems/comments?? Make sure to read the release notes and then use the Discussion Forum - that's what it's there for...
---
Donations
Donations are accepted.
Click here to donate to help support MTmyVFP and Open Source VFP projects.

Thank you for your support!

Last edited Jan 9 2011 at 3:53 PM by claudefox, version 70