Autor Beitrag
csigg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 706

WIn XP, Win NT, Win2000, Suse8.0
Delphi 5, Delphi 6
BeitragVerfasst: Do 31.03.05 10:42 
ich hoffe voon euch kann mir jemand helfen, habe ein Programm das sich alle 15 Minuten einmal aktualisieren soll.
bis jetzt hab ich das so gemacht:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
procedure Tfrm_Main.Timer2Timer(Sender: TObject);
var present: TTime;
    Hour:    word;
    Min:     word;
    Sec:     word;
    Msec:    word;
    temp:    word;
begin
present := now;
DecodeTime(Present, Hour, Min, Sec, MSec);
if (min mod 15) = 0 then
begin
  ShowMessage('Timer refresh');
  prc_refresh;
end;
end;

allerdings macht er jetzt zu jeder viertelstunde 60x ein resfreh, habt ihr ne gute Idee wie das anders realisierbar ist??
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Do 31.03.05 10:47 
Hallo,

ein Timer besitzt die Eigenschaft Interval. Die Angabe dort bezieht sich auf Millisekunden. Wenn Du der Eigenschaft den Wert 900000 (15 Min * 60 Sek. * 1000 ms) angibst, erübrigt sich die Zeitberechnung in Deiner Routine.

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
csigg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 706

WIn XP, Win NT, Win2000, Suse8.0
Delphi 5, Delphi 6
BeitragVerfasst: Do 31.03.05 10:49 
Das geht leider nicht weil er sich immer zur viertelstunde aktualisieren muss, hängt mit nem Terminplaner zusammen.
LCS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1305
Erhaltene Danke: 1

WIN 7, WIN 8
Delphi XE5, Delphi XE, Delphi 2007
BeitragVerfasst: Do 31.03.05 10:49 
Hi
zum Beispiel so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure Tfrm_Main.Timer2Timer(Sender: TObject);
var present: TTime;
    Hour:    word;
    Min:     word;
    Sec:     word;
    Msec:    word;
    temp:    word;
begin
present := now;
DecodeTime(Present, Hour, Min, Sec, MSec);
if ((min mod 15) = 0) and (min <> lastRefresh) then
begin
  ShowMessage('Timer refresh');
  prc_refresh;
  lastRefresh := min;
end;
end;

die Variable lastRefresh definierst du global in deiner Unit und setzt sie beim Start auf -1

Gruss Lothar

_________________
Der BH ist für die Brust, der Plan ist für'n Ar...
csigg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 706

WIn XP, Win NT, Win2000, Suse8.0
Delphi 5, Delphi 6
BeitragVerfasst: Do 31.03.05 10:50 
Habs grad rausgefunden wie, hab das Intervall auf 60.000 gesetzt, das heisst er gibt jede minute nur einmal ein Signal, somit hat sich da Problem erledigt.

@LCS
hab ich erst auch gedacht, aber ich meine, Meine Methode ist einfacher :)

Moderiert von user profile iconraziel: Beiträge zusammengefasst.