Praticamente l'esempio consiste nel fatto che vi e' una progress bar nel form principale, questa progress bar si incrementa ogni 50 millisecondi.
Le funzionalità di incremento sono demandate al thread, per il semplice fatto che nel frattempo che la barra si incrementa voglio svolgere altre operazioni.
Questo e' il mio main.



void __fastcall TForm1::AvviaFunzioniDBClick(TObject *Sender)
{
Thread = new TMyThread (false, ProgressBar1);
Thread->FreeOnTerminate = true;

}
//---------------------------------------------------------------------------


Questo invece e' il mio thread ...


__fastcall TMyThread::TMyThread(bool CreateSuspended)
: TThread(CreateSuspended)
{
}
//---------------------------------------------------------------------------
__fastcall TMyThread::TMyThread (bool CreateSuspended, Comctrls::TProgressBar *temp) : TThread(CreateSuspended)
{
PBar = temp;
Priority = tpIdle;

// PBar e' stata dichiarata nel .h con: Comctrls::TProgressBar *PBar;


}//---------------------------------------------------------------------------
void __fastcall TMyThread::Execute()
{
Synchronize(MyFunction ());
}
//---------------------------------------------------------------------------
void __fastcall TMyThread::MyFunction ()
{
PBar->Position = 0;
for (int i=0;i<100;i++)
{
Sleep (50);
PBar->StepIt ();
}
}
//---------------------------------------------------------------------------

Premetto che con thread ho poca familiarità in quanto ho incominciato a studiarli da poco.