Solved

Time Component  Question

Posted on 1998-03-04
2
150 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

860 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