DELPHI time trigger event!

Source: Internet
Author: User
1 procedure TForm1.Timer2Timer (Sender: TObject );
2 // delphi time trigger event
3 var
4 S, D: TDateTime;
5 ActiveHH: string; // trigger hour
6 ActiveMM: string; // trigger score
7 ActiveSS: string; // trigger second
8 begin
9 s: = strtodatetime (FormatDateTime ('hh: mm: ss', Now); // time
10
11 ActiveHH: = Edit3.Text; // hour
12 ActiveMM: = Edit4.Text; // minute
13 ActiveSS: = Edit5.Text; // second
14
15
16 D: = strtodatetime (ActiveHH + ':' + ActiveMM + ':' + ActiveSS); // to time
17
18 // triggered on the current day
19 if FormatDateTime ('yyyy-MM-DD ', DateTimePicker2.date) = FormatDateTime ('yyyy-MM-DD', now) then
20 begin
21 if s = d then // triggered at the same time
22 begin
23 showmessage ('the computer is exploding! ');
24 // in the middle, you add the database statement you want to execute.
25 end;
26 end;
27
28 end;

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.