Como te indica
Neftali, es posible pero siempre que vayas a trabajar con un elemento de la VCL desde un hilo, sebes usar si o si,
Synchronize.
Te pongo un ejemplo simple de un hilo que modifica un Label en un Form modal:
Código:
#define Unit2H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include "Unit3.h"
//---------------------------------------------------------------------------
class ThPrueba : public TThread
{
private:
TForm3 *Form;
String LS;
protected:
void __fastcall Execute();
public:
__fastcall ThPrueba(TForm3 *form, bool CreateSuspended);
void __fastcall ActualizaLabel();
};
//---------------------------------------------------------------------------
#endif
Código:
#include <vcl.h>
#pragma hdrstop
#include "Unit2.h"
#pragma package(smart_init)
__fastcall ThPrueba::ThPrueba(TForm3 *form, bool CreateSuspended)
: TThread(CreateSuspended)
{
Form = form;
}
void __fastcall ThPrueba::ActualizaLabel()
{
Form->Label1->Caption = LS;
}
//---------------------------------------------------------------------------
void __fastcall ThPrueba::Execute()
{
int n=0;
while(!Terminated){
LS = n++;
Synchronize(ActualizaLabel);
Sleep(500);
}
}
Saludos.