Solved

Getting track position in TMediaPlayer

Posted on 2001-06-24
2
253 Views
Last Modified: 2007-12-19
I am having trouble getting the number of seconds, hours, minutes have gone by in the current track in the TMediaPlayer control. When i decode the 4-byte integer the numbers are wrong....HELP!!
0
Comment
Question by:shodgkiss
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 100 total points
ID: 6222833
You can use the MCI_TMSF* macros to help you out here...

void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
LONG CurrentInfo = MediaPlayer1->Position;
int CurrentTrack = MCI_TMSF_TRACK(CurrentInfo);
int CurrentMins = MCI_TMSF_MINUTE(CurrentInfo);
int CurrentSecs = MCI_TMSF_SECOND(CurrentInfo);

LONG TrackInfo = MediaPlayer1->TrackLength[CurrentTrack];
int TrackMins = LOBYTE(LOWORD(TrackInfo));
int TrackSecs = HIBYTE(LOWORD(TrackInfo));

int NumTracks = MediaPlayer1->Tracks;

CurrentTrackLabel->Caption = IntToStr(CurrentTrack) + " of " +
IntToStr(NumTracks);
CurrentTimeLabel->Caption = IntToStr(CurrentMins) + ":" +
IntToStr(CurrentSecs);
TrackLengthLabel->Caption = IntToStr(TrackMins) + ":" +
IntToStr(TrackSecs);
}

I hope, it helps. Alex
0
 

Author Comment

by:shodgkiss
ID: 6228755
What timeformat was i suppost to use? because every number is completely wrong when i run it.Is there a header file to include?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question