?
Solved

Getting track position in TMediaPlayer

Posted on 2001-06-24
2
Medium Priority
?
256 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 400 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

770 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