Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Trigger events

Posted on 1999-01-24
3
Medium Priority
?
168 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
  • 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

926 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