TThread help needed


2005-09-09 10:49:02 PM
cppbuilder50
All TThread examples I have found are either too basic or too complex,
and the help on them does not answer the questions I have.
Here is what I have:
Form1* frmMain (inherits from TForm)
CheckBox1 on Form1
void __fastcall TForm::MyFunction(void* params)
{
Download(param->filename);
}
Thread1* thread (inherits from TThread)
Q1) Can I put a TThread on Form1? Since Form1 inherits from TForm, how
would I code TThread so that I can also override the Execute() method?
There is no TThread component to drop on the form.
Q2) CheckBox1 on Form1 determines if MyFunction is called directly or
using TThread. I have never seen an example of this. Should this be a
problem?
Q3) When I call Synchronize(MyFunction) in the TThread's Execute
method, does my program return immediately or after MyFunction has
completed?
Q4) Can MyFunction read/write data to my Form1?
Q5) Does MyFunction need to have a specific footprint (input params and
return types)? If so, how do I specify "params" in my call to
Synchronize(MyFunction)? If MyFunction has a return type, how do I
check that?
Simple solutions are better. If I can make the simple solution work, I
can expand it to be more complex later.
Regards,
Joe