Solved

Getting track position in TMediaPlayer

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
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 additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

707 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now