1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33:
| procedure TForm1.Button1Click(Sender: TObject); var AlarmTimer : THandle; Zeit : Large_Integer; begin Label1.Caption:='Running...'; AlarmTimer := CreateWaitableTimer(nil, False, nil); CancelWaitableTimer(AlarmTimer); Zeit.QuadPart := 10 * (-10000000); SetWaitableTimer(AlarmTimer, Zeit.Quadpart, 0, nil, nil, False); while WaitForSingleObject(AlarmTimer, 20) <> Wait_Object_0 do begin Application.ProcessMessages; end; Label1.Caption:='Ready'; end;
procedure TForm1.Button2Click(Sender: TObject); var AlarmTimer : THandle; Zeit : Large_Integer; begin Label2.Caption:='Running...'; Application.ProcessMessages; AlarmTimer := CreateWaitableTimer(nil, False, nil); CancelWaitableTimer(AlarmTimer); Zeit.QuadPart := 30 * (-10000000); SetWaitableTimer(AlarmTimer, Zeit.Quadpart, 0, nil, nil, False); while WaitForSingleObject(AlarmTimer, INFINITE) <> Wait_Object_0 do begin Application.ProcessMessages; end; Label2.Caption:='Ready'; end; |