Autor Beitrag
mathias
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 58
Erhaltene Danke: 3



BeitragVerfasst: Fr 14.06.02 22:45 
Läuft nicht auf 486 und älter
ausblenden Delphi-Quelltext
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:
function Herz : Double;  {$O-}
var
  TimerHigh, TimerLow: DWORD;
begin
  SetPriorityClass(GetCurrentProcess, REALTIME_PRIORITY_CLASS);
  SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_TIME_CRITICAL);
  asm
    push    10
    call    Sleep;
    dw      310Fh
    mov     TimerLow, eax
    mov     TimerHigh, edx
    push    500
    call    Sleep
    dw      310Fh
    sub     eax, TimerLow
    sbb     edx, TimerHigh
    mov     TimerLow,  eax
    mov     TimerHigh, edx
  end;
  Result := TimerLow / 500000.0;
end;        {$O+}

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage(FloatToStr(Herz));
end;
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: Sa 15.06.02 16:57 
Die Prioritäten sollten anfangs der Prozedur in einer temp. Variablen
gespeichert werden und am Ende wieder hergestellt werden.
tmkb
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 59



BeitragVerfasst: Do 04.07.02 23:34 
Gibts einen ähnlichen Code für WinNT/2000/XP Systeme? Da wirft er nämlich nur Stuss aus.
Pit
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 160



BeitragVerfasst: Fr 05.07.02 00:03 
tmkb hat folgendes geschrieben:
Gibts einen ähnlichen Code für WinNT/2000/XP Systeme? Da wirft er nämlich nur Stuss aus.

Kann ich nicht bestätigen, ich habe aber auch schon von Problemen damit gehört. Am Betriebssystem liegt es nicht, bei mir läuft eine sehr ähnliche Variante problemlos unter Win98, WinNT, Win2k und WinXP.

Die Funktion ist allerdings nicht besonders optimal, sie benötigt mindestens 500 ms. Poste mal, ob und wenn ja, welche der beiden anderen Variante(n) funktionieren.

MfG Pit.