Solved

Getting track position in TMediaPlayer

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Connecting to MS SQL db from Win32 application written in C 3 85
C Language combined operators 28 109
Template syntax for variable length arrays 9 75
Header of docx file 17 103
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

778 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