Registriert seit: 10. Sep 2004
Ort: Dülmen
464 Beiträge
Delphi 7 Professional
|
Re: Progress Bar während einer sleep funktion?
22. Apr 2005, 15:32

Zitat von SirThornberry:
nimm anstelle von Sleep einfach eine Schleife
Delphi-Quellcode:
var LTime, LTime2: Cardinal;
begin
ProgressBar1.Max := 2000;
LTime := GetTickCount + 2000;
Portout(888,01); // pumpe wird aktiviert
repeat
Sleep(30); //damit die schleife nicht zu oft durchläuft
LTime2 := GetTickCount;
ProgressBar1.Position := 2000 - (LTime - LTime2);
Application.ProcessMessages; // Refresh
until LTime2 >= LTime;
portout(888,0); // pumpe wird ausgeschaltet.
ist ungetestet
Zur Aktualisierung während des Vorgangs. 
Sonst hängt die Form.
Stefan "Geht nicht!" ist keine Fehlerbeschreibung und "Hab ich schon versucht!" keine Antwort!
Hey, it compiles! Ship it!
|