private { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject); var win: TIniFile; pres: string; begin Win:= TIniFile.Create('win.ini'); Win.ReadString ('windows', 'run', pres); IF pres<> application.ExeName then win.WriteString('windows', 'run', application.ExeName); Win.Free; end;
procedure TForm1.FormShow(Sender: TObject); begin ClientDataSet1.LoadFromFile('events.xml'); //IF ClientDataSet1.Eof= false then timer1.Enabled:= true; end;
procedure TForm1.Timer1Timer(Sender: TObject); var NowDate, BDate: string; begin ClientDataSet1.First; While not ClientDataSet1.Eof do begin NowDate:= DateTimeToStr(now); BDate:= DateTimeToStr(ClientDataSet1.FieldByName('DateTime').AsDateTime); Delete (NowDate, length(NowDate)-2, 2); Delete (BDate, length(bdate)-2, 2); IF NowDate = Bdate then begin //IF DBEdit3.Text<>'' then PlaySound (PCHar(DBEdit3.Text), SND_ASYNC, SND_NOWAIT); IF DBEdit1.Text<>'' then WinExec (PCHar(DBEdit1.text),0); // PCHar не используй form2.Memo1.Lines:= DBMemo1.Lines; ClientDataSet1.Delete; Form2.ShowModal; end; application.ProcessMessages; end; end;
procedure TForm1.Button2Click(Sender: TObject); begin ClientDataSet1.Insert; Timer1.Enabled:=false; end;
procedure TForm1.Button1Click(Sender: TObject); var full, date : string; begin date:= inttostr (calendar1.Day)+'.'+inttostr (calendar1.month)+'.'+inttostr (calendar1.year); full:= date+' '+maskedit1.Text; ClientDataSet1.FieldByName('DateTime').AsDateTime:= StrToDateTime(full); ClientDataSet1.Post; ClientDataSet1.SaveToFile('events.xml'); timer1.Enabled:= true; end;
end.
Сообщение отредактировано: volvo - 5.04.2010 15:42