/此函数执行在播放过程中进行动态的时间播放显示功能
void __fastcall TSuperPlayerform::Timer3Timer(TObject *Sender)
{
long int remaintime;
MediaPlayer1->TimeFormat=tfMilliseconds;
//转换时间显示模式
lLength=MediaPlayer1->Length;
vform->Caption=ExtractFileName(MediaPlayer1->FileName);
lPosition=MediaPlayer1->Position;
remaintime=lLength-lPosition;
LabelTime->Caption=IntToStr(lLength/(1000*60))+":"+IntToStr((lLength%(1000*60)/1000)/10)+IntToStr((lLength%(1000*60)/1000)%10);
if(!N6->Checked) //显示播放时间
{
LabelHour->Caption=IntToStr((lPosition/(1000*3600))/10)+IntToStr((lPosition/(1000*3600))%10);
LabelMinute->Caption=IntToStr((lPosition/(1000*60))/10)+((lPosition/(1000*60))%10);
Labelse
conds->Caption=IntToStr((lPosition%(1000*60)/1000)/10)+IntToStr((lPosition%(1000*60)/1000)%10);
}
else
//显示剩余播放时间
{
LabelHour->Caption=IntToStr((remaintime/(1000*3600))/10)+IntToStr((remaintime/(1000*3600))%10);
LabelMinute->Caption=IntToStr((remaintime/(1000*60))/10)+((remaintime/(1000*60))%10);
Labelse
conds->Caption=IntToStr((remaintime%(1000*60)/1000)/10)+IntToStr((remaintime%(1000*60)/1000)%10);
}
}
这是C++BUILDER的代码,你把它翻译成DEPHI即可