procedure Wait(lNumberOfSeconds : Longint); const _SECOND = 10000000; var lBusy : LongInt; hTimer : LongInt; liDueTime : LARGE_INTEGER; begin hTimer := CreateWaitableTimer(nil, True, 'WaitableTimer'); if hTimer = 0 then Exit; liDueTime.QuadPart := -10000000 * lNumberOfSeconds; SetWaitableTimer(hTimer, TLargeInteger(liDueTime), 0, nil, nil, False); repeat lBusy := MsgWaitForMultipleObjects(1, hTimer, False, INFINITE, QS_ALLINPUT); Application.ProcessMessages; Until lBusy = WAIT_OBJECT_0; // Close the handles when you are done with them. CloseHandle(hTimer); End; procedure TForm1.Button1Click(Sender: TObject); begin form1.Caption := 'start'; wait(10); form1.Caption := 'done'; end;