Solved

Time Component  Question

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This video discusses moving either the default database or any database to a new volume.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

705 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now