Solved

Time Component  Question

Posted on 1998-03-04
2
149 Views
Last Modified: 2010-04-06
I have a program that I want to send out a message every 4 hrs.or 6 hrs etc., or whatever the enduser chooses. How can I do this, by using the TTime component?  Or should I use something else.  Please give me an example if you can.

Thanks,
Tony
0
Comment
Question by:aj85
2 Comments
 

Expert Comment

by:Marcelito
ID: 1360069
You can set the interval property of the TTimer component in miliseconds. 4 hours are 3600000 miliseconds. In the OnTimer event you may put the code that you want execute.

Ej: Is a Form with a TTimer.

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls;

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Timer1Timer(Sender: TObject);
begin
                  {Your specific code}
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
    Timer1.Interval:=3600000;     {Set the time that you want}
end;

end.


Good Luck!!!! Send news!!
0
 

Accepted Solution

by:
puppy earned 50 total points
ID: 1360070
if you want that the user can change it
then try this:
put a timer
put an edit text
and a button
take the event OnClick of the button
and insert this source:
timer1.Interval:=strtoint(edit1.text);
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

775 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question