Link to home
Start Free TrialLog in
Avatar of kkoser
kkoser

asked on

Windows Media Player

How do I Display the "Status Bar" Info into a textbox?

My form uses the Windows Media Player to Play an .mp3 file. I would like for it to display the Song Length/Time Remaining in a textbox.

To do this i suppose i could use a timer to refresh the Time Remaining part of it.

But i am lost as far as getting the Info in the first place.
Avatar of kkoser
kkoser

ASKER

bumped up the points.
ASKER CERTIFIED SOLUTION
Avatar of mcrider
mcrider

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kkoser

ASKER

Thanx a lot. it works good. But, How do i get it to display the time instead of a count? i.e., a 4:21 minutes long song displays as 261.

if you divide 261 by 60, you get 4.35 minutes... Just takes alittle division and formatting.

Understand?


Cheers!

Avatar of kkoser

ASKER

I understand the division part of the issue.


i used this:

 Label1.Caption = CStr(Fix(.CurrentPosition / 60)) & "/" &
                      CStr(Fix(.Duration / 60))

This won't display anything after the whole numbers.( i.e. (4.35) shows as (4)).

Although 261 divided by 60 = 4.35,
the duration for a 4.21 mp3 shows as 261. I wonder why that is?


However, I don't know how to format it to display the same as windows media player.   i.e. 00:00/00:00.

I guess this is what i was looking for.
In the formula, Fix() returns a whole number.  Remove the Fix() portions and you will get the decimal notation.


Cheers!
To display a time format, you could use the following function:

Function TimeFormat(lValue As Long) As String
    Dim lMin As Long
    Dim lSec As Long
    lMin = Fix(lValue / 60)
    lSec = lValue - (lMin * 60)
    TimeFormat = Format(lMin, "00:") + Format(lSec, "00")
End Function


Then do:

Label1.Caption = TimeFormat(.CurrentPosition) & "/" & TimeFormat(.Duration)


Cheers!

Avatar of kkoser

ASKER

Sorry for not responding so quickly. Kids with the flu...

This works absolutely awesome!

Thanx a lot.

Avatar of kkoser

ASKER

One more thing,

I have another question out there (Q.10223451). You had answered it but i had rejected it because i needed more elaboration. Since then, the problem has been resolved and no one has answered it. Could you answer the question so i can "Clean-Up" my mess?

Thanx in advance.

 
You're quite welcome!  Glad I could help... (I posted on the other question, Waiting for you to grade it...)


Cheers!