Thema: Delphi GetTickCount

Einzelnen Beitrag anzeigen

Basilikum

Registriert seit: 9. Aug 2003
389 Beiträge
 
Delphi 7 Professional
 
#5

Re: GetTickCount

  Alt 18. Mär 2006, 22:40
Zitat von ontorius:
Delphi-Quellcode:
procedure TForm1.trash;
var start:longint;
    i:integer;
begin
  repeat
    start:=gettickcount;
    if start+50=gettickcount then image4.picture.LoadFromFile('.\pics\trash_open1.bmp');
    if start+100=gettickcount then image4.Picture.loadfromfile('.\pics\trash_open2.bmp');
    if start+150=gettickcount then image4.Picture.LoadFromFile('.\pics\trash_blum.bmp');
    if start+2150=gettickcount then image4.Picture.loadfromfile('.\pics\trash.bmp');
    inc(i);
  until i=10;
end;
An der Stelle wo das Programm die oben genannte Prozedur aufruft, bleibt es einfach stehen und man kann darin nichts mehr machen. Wie muss man mit "GettickCount" umgehen?
das "Stehenbleiben" hängt vermutlich damit zusammen, dass du i nicht initialisierst.... wenn nun i vor repeat zufälligerweise genau 11 ist, so wird die Schlaufe ca. 4'000'000'000 durchlaufen... und das dauert seine Zeit...
füge mal ein i:=0 vor repeat ein....
  Mit Zitat antworten Zitat