1 //this code is helpful if you want to write an app to detect whenever 2 //the system time of you PC has changed. 3 //-----------------------------UNIT1.H------------------------------------- 4 5 #ifndef Unit1H 6 #define Unit1H 7 //--------------------------------------------------------------------------- 8 #include <Classes.hpp> 9 #include <Controls.hpp> 10 #include <StdCtrls.hpp> 11 #include <Forms.hpp> 12 //--------------------------------------------------------------------------- 13 class TForm1 : public TForm 14 { 15 __published: // IDE-managed Components 16 TButton *Button1; 17 void __fastcall Button1Click(TObject *Sender); 18 private: // User declarations 19 void __fastcall WMTIMECHANGE(TMessage &Message); 20 public: // User declarations 21 __fastcall TForm1(TComponent* Owner); 22 BEGIN_MESSAGE_MAP 23 VCL_MESSAGE_HANDLER(WM_TIMECHANGE, TMessage,WMTIMECHANGE) 24 END_MESSAGE_MAP(TForm) 25 26 27 }; 28 //--------------------------------------------------------------------------- 29 extern PACKAGE TForm1 *Form1; 30 //--------------------------------------------------------------------------- 31 #endif 32 33 //-----------------------------UNIT1.CPP---------------------------------- 34 #include <vcl.h> 35 #pragma hdrstop 36 37 #include "Unit1.h" 38 //--------------------------------------------------------------------------- 39 #pragma package(smart_init) 40 #pragma resource "*.dfm" 41 TForm1 *Form1; 42 //--------------------------------------------------------------------------- 43 __fastcall TForm1::TForm1(TComponent* Owner) 44 : TForm(Owner) 45 { 46 } 47 //--------------------------------------------------------------------------- 48 49 void __fastcall TForm1::WMTIMECHANGE(TMessage &Message) 50 { 51 ShowMessage("Time changed"); 52 53 } 54 void __fastcall TForm1::Button1Click(TObject *Sender) 55 { 56 Form1->Close(); 57 }