1 2 //--------------------------------------------------------------------------- 3 4 #include <vcl.h> 5 #pragma hdrstop 6 7 #include "Unit1.h" 8 //--------------------------------------------------------------------------- 9 #pragma package(smart_init) 10 #pragma resource "*.dfm" 11 TForm1 *Form1; 12 //--------------------------------------------------------------------------- 13 __fastcall TForm1::TForm1(TComponent* Owner) 14 : TForm(Owner) 15 { 16 } 17 //--------------------------------------------------------------------------- 18 19 void __fastcall TForm1::Button1Click(TObject *Sender) 20 { 21 TSystemTime MyTime; 22 MyTime.wYear =2004; 23 MyTime.wMonth = 12; 24 MyTime.wDay = 24; 25 MyTime.wDayOfWeek=0; 26 MyTime.wHour=7; 27 MyTime.wMinute=0; 28 MyTime.wSecond=0; 29 MyTime.wMilliseconds=0; 30 31 if (SetSystemTime(&MyTime) == 0) { 32 ShowMessage ("Failed to set system time."); 33 34 } 35 36 37 } 38 //---------------------------------------------------------------------------