Solved

Getting track position in TMediaPlayer

Posted on 2001-06-24
2
255 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

Technology Partners: 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

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

688 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