Use the included class to give your own VFP desktop code multi-threading capability. Test and use the examples in the included simple form, or, just create and run a thread 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 VFP1.) 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 codeParam 3 (optional) - code that will run when your thread completesParam 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:
oThreadMgr.SendMsgToStopThreads() - stop the threads
oThreadMgr.SuspendThreads() - pause the threads
oThreadMgr.ResumeThreads() - resume the threads
NOTES:
Questions/problems/comments?? Make sure to read the
release notes and then use the
Discussion Forum - that's what it's there for...
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.aspxFor more elaborate examples of using this class see:
VFPWebCrawler -
http://www.codeplex.com/vfpwebcrawlerand
Thread Test by Fernando Bozzo (VFP 8,9)
-
http://www.portalfox.com/articulos/archivos/bozzo/Test_Threads.zip