//--------------------------------------------------------------------------- #include #pragma hdrstop #include "WDGThrd1.h" #include "sample1u.h" #include "wdg.h" #pragma package(smart_init) //extern *Form1; //extern WDGLabel; //--------------------------------------------------------------------------- // Important: Methods and properties of objects in VCL can only be // used in a method called using Synchronize, for example: // // Synchronize(UpdateCaption); // // where UpdateCaption could look like: // // void __fastcall WDGThread::UpdateCaption() // { // Form1->Caption = "Updated in a thread"; // } //--------------------------------------------------------------------------- unsigned char Data; __fastcall WDGThread::WDGThread(bool CreateSuspended) : TThread(CreateSuspended) { } //--------------------------------------------------------------------------- void __fastcall WDGThread::UpdateCaption() { Form1->WDGLabel->Caption = IntToHex(Data, 2); } //--------------------------------------------------------------------------- void __fastcall WDGThread::Execute() { unsigned int IRQ_Occurred; Data = 0; Synchronize(UpdateCaption); IRQ_Occurred = WDGGetStatus(&Data); if (IRQ_Occurred == true) Synchronize(UpdateCaption); }