Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Trigger events

Posted on 1999-01-24
3
Medium Priority
?
167 Views
Last Modified: 2010-04-06
Hi All,

What's the best way to trigger one event at any 30 minutes
(7:00,7:30,...12:00,12:30 and so on) using TTimer.
Any code or another one component will be welcome.

Regards
Paulo
0
Comment
Question by:sergio_2001
[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
3 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 150 total points
ID: 1363110
Hi,
i ask this last week :-)
Set your Timer to 1800000
then it will fire every 30 minutes
Regards Barry
0
 
LVL 17

Expert Comment

by:inthe
ID: 1363111
here is a prog i did to get a screencapture every 30 minutes:
set timer to 1800000

unit Unit1;

interface

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

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

var
  Form1: TForm1;
  y:Integer;
  x:String;
  implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
Timer1.Enabled:=True;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
VAR
DC:HDC;
Bmp:TBitmap ;
begin
Image1.Picture.Free;
Inc(y);
x:=IntToStr(y);
Timer1.Enabled:=False;
DC:=getDC(GetDeskTopWindow);
Bmp:=TBitmap.Create;
Bmp.Width:=Screen.Width;
Bmp.Height:=Screen.Height;
BitBlt(Bmp.Canvas.Handle,0,0,Screen.Width,Screen.Height,DC,0,0,SRCCOPY);
Image1.Picture.Bitmap:=Bmp;
ReleaseDC(DC,DC);
Bmp.Free;
Image1.Picture.SaveToFile('C:\DCSC'+x+'.BMP');
Sleep(5000);
Timer1.Enabled:=True;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
y:=1;
end;

end.
0
 
LVL 1

Expert Comment

by:Oli2
ID: 1363112
Instead of setting the TTimer component's interval to 1800000, you could also set it to
1000 ( one second ) and check the current time.
store the starttime in a var, then check, if the current time is more than 30 minutes past the starttime. if so, do your thing and reinitialize the starttime with the current time, so it will get fired again 30 minutes later.

Greetings, Oli
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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 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.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

730 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