Autor Beitrag
DXC
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 61

WINXP + SP2
D6 Pers, D2005 Pers
BeitragVerfasst: Di 16.08.05 19:48 
Hi,

Also mein Problem ist ich von der TMediaPLayer Kompo die Aktuelle Trackposition auslesen lassen es sollte dann z.B in nem Edit so angezeigt werden:

10:20:30:500

Stunden:Minuten:Sekunden:Millisekunden

Leider hab ich keinen Peil wie ich so was machen soll... :oops:
Würd mich auf ne Antwort Freun... :wink:

MFG
DXC
DXC Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 61

WINXP + SP2
D6 Pers, D2005 Pers
BeitragVerfasst: Mi 17.08.05 11:59 
Weiß wirklich keiner ne antwort ? :cry:
Ich hab mir jetz mal überlegt des ganze mit nem Timer(n) zu machen aber des is auch net so des wahre...

MFG
DXC
Fabian W.
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Mi 17.08.05 12:02 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
function TForm1.MSecToDMS(MSec: int64):string;
var
AllesInSekunden: int64;
AllesInMinuten,RestMinuten,RestSekunden,Stunden : integer;

begin
result := '00:00:00 h';
  try
  AllesInSekunden := MSec div 1000;  //MilliSekunden in Sekunden umrechen
  AllesInMinuten := AllesInSekunden div 60;   //Alle Minuten rausholen
  RestSekunden := AllesInSekunden - AllesInMinuten * 60;  //Restliche Sekunden berechen
  Stunden := AllesInMinuten div 60;   //Alle Stunden rausholen
  RestMinuten := AllesInMinuten - Stunden * 60;   //Restliche Minuten berechnen

  result := formatfloat('00',Stunden)+':'+formatfloat('00',RestMinuten)+':'+formatfloat('00',RestSekunden)+' h';
  except
  result := '00:00:00 h';
  Exception.Create('Es sind Fehler aufgetreten');
  end;
end;
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 17.08.05 12:08 
Kann man beim TMediaplayer nicht irgendwie das Ausgabeformat einstellen? Ich meine da was in Erinnerung zu haben. :gruebel:
DXC Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 61

WINXP + SP2
D6 Pers, D2005 Pers
BeitragVerfasst: Mi 17.08.05 12:09 
:flehan: :flehan: :flehan: Danke vielmals .... werds gleich ausprobieren ... :wink:

MFG
DXC
Fabian W.
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Mi 17.08.05 12:19 
Zitat:
Kann man beim TMediaplayer nicht irgendwie das Ausgabeformat einstellen? Ich meine da was in Erinnerung zu haben. :gruebel:

Ich hatte, zumindest under D3, nach sowas gesucht, aber net gfunde - daraufhin hab ich dann die function geschrieben.
Roy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Mo 23.04.07 12:09 
Hallo Fabian,
wie kann ich diese Function MSecToDMS aufrufen? Mit einer Procedur über einen Timer? Er meldet mir das er dass Element MSecToDMS nich kennt! Muss ich in die Unit was einbinden oder eine const setzen?

Komme nicht weiter damit!

Danke Roy
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Mo 23.04.07 12:16 
Du musst die Prozedur im type-Bereich "bekannt" machen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
  // Beispiel:
  TForm1 = class(TForm)
    // ...
    procedure FormCreate(Sender: TObject);
    function MSecToDMS(MSec: Int64): String;       // oder auch nach private / public
    // ...
  private
    // ...

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)