Autor Beitrag
Bronstein
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 578
Erhaltene Danke: 1

WIN XP
Delphi 6 / Delphi 2006 / Delphi XE
BeitragVerfasst: So 29.02.04 10:33 
Möchte rein durch Code eine Funktion schreiben, die wenn das Programm an eine bestimmte stelle gelangt, 5 Minuten wartet, bis es weiter macht. Möchte aber nicht die Komponent unter System/ Timer, da ich kein Formular habe.
mfg

_________________
Es gibt keine dummen Fragen nur dumme Antworten!!!
yukon-troll
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 60



BeitragVerfasst: So 29.02.04 13:58 
Hallo,

benutze die Procedure "sleep" in Verbindung mit "Application.ProcessMessages"
in einer Schleife (damit Dein Programm während des "Nichtstuns" noch auf Systemereignisse reagiert).

als Beispiel:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure Wait5Minutes;
var
  i: integer;
begin
  for i := 1 to 3000 do
  begin
    sleep(100);
    Application.ProcessMessages;
  end;
end;


MfG yukon-troll
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 29.02.04 14:08 
Such mal hier nach Suche in: Delphi-Forum, Delphi-Library DELAY, das ist die bessere Lösung für dein Problem.
Nomak
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18


D6Ent, D7Ent
BeitragVerfasst: Mo 01.03.04 18:40 
Alternativ:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure Wait(time: word);
var
  start: integer;
begin
  start := GetTickCount;
  while GetTickCount-start <= time do
    Application.ProcessMessages;
end;



Nomak

Moderiert von user profile iconMotzi: Delphi-Tags hinzugefügt.

_________________
Nomak
Teddyman
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32



BeitragVerfasst: Di 06.04.04 08:34 
Titel: probiere mal das...
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure Wait(time:word); 
var start: integer; 
begin 
 start := GetTickCount; 
 while GetTickCount - start <= time do 
 Application.ProcessMessages; 
end;


und an der stelle, wo gewartet werden soll, einfach angeben, z.bsp.: wait(3000)
//3 sekunden


Moderiert von user profile icontommie-lie: Delphi-Tags hinzugefügt