?
Solved

Time Component  Question

Posted on 1998-03-04
2
Medium Priority
?
154 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 100 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month11 days, 22 hours left to enroll

752 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