Autor Beitrag
curtiss
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 59



BeitragVerfasst: Mo 20.04.09 12:24 
Hallo, folgendes: Ich schreibe grade einen dienst und brauche da eine warte anweisung. Da hab ich hier auch schon eine gefunden die mir gut gefällt, weil diese Methode die anderen events noch abarbeitet, während des wartens und somit nichts "einfriert".

Nun denn, ich habe leider kein 'Terminate' an meinem aplication (da Service)
was habe ich für möglichkeiten diese Methode doch zu nutzen?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
procedure TMainService.SleepX(Milliseconds: Integer);
var
  TC: DWORD;
begin
  TC := GetTickCount;
  repeat
    if application.Terminated then
       exit;
    Application.ProcessMessages; // <--- non-thread
    sleep(1);
  until ((GetTickCount-TC) > Milliseconds);
end;//--TMainService.SleepX


MFG!


Moderiert von user profile iconNarses: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Mo 20.04.2009 um 18:26
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mo 20.04.09 12:51 
Application.Terminated gibt an, ob bereits ein Auftrag zum Beenden der Anwendung eingegangen ist. In einem Dienst kannst Du diese Information entweder über den SCM abfragen, diesen Fall ignorieren, oder anderweitig auf eine Status-Änderung im SCM reagieren.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
curtiss Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 59



BeitragVerfasst: Mo 20.04.09 15:20 
danke danke, das thema hat sich auch schon wieder erledigt